python - 自定义嵌入未显示
问题描述
我正在制作机器人,它需要一个命令后跟一个输出嵌入的字符串
我的想法是让它遵循以下准则: al_emb "Title Here" "Description Here"
到目前为止我的代码:
@bot.command()
async def emb(c,embed):
#first = c.content.split()[1]
#second = c.content.split()[2]
first = c.content
#embed = embed.Embed(title=first, description=second, color=0x00ff00)
embed = embed.Embed(title=first, color=0x00ff00)
await c.send(embed=embed)
我没有输出
非常感谢任何帮助
解决方案
您可以在协程的签名中包含两个参数:
class MyCog(commands.Cog):
@commands.command()
async def emb(self, ctx, title, description):
embed = discord.Embed(title=title, description=description, color=0x00ff00)
await ctx.send(embed=embed)
推荐阅读
- html - 如何使用 django 制作像 sportify 和 SoundCloud 这样的音频共享或流媒体网站
- json - 使用 spark 读取多个 json 模式
- java - 如何停止占用麦克风
- java - 如何将文件从 HDFS 复制到集群节点的本地文件系统,在 EMR 集群中,使用 java api,
- python - Python 出现 SSL 错误,但服务器测试给出所有 A+ 评级
- python - Gensim Word2Vec '在训练模型之前必须先建立词汇表'
- python - 使用 pandas 数据框进行转置和旋转
- xcode - 在 Xcode 10 上运行反应原生应用程序
- javascript - 提高精灵绘制性能
- android - 将值从活动发送到其片段