【问题标题】:How to embed gif in discord's rich embed? like hug, kiss commands如何在不和谐丰富的嵌入中嵌入 gif?像拥抱,亲吻命令
【发布时间】:2021-04-26 16:30:50
【问题描述】:

我正在使用 discord.py 制作一个不和谐机器人,但我不知道如何在嵌入中发送 gif。我正在尝试发出诸如拥抱、亲吻、嘘声等命令。我该怎么做?


          embed1 = discord.Embed(title="this is a title", description="this is a description!", color=0x00ff00,)
        await message.channel.send(embed = embed1)```

【问题讨论】:

  • 欢迎来到 Stack Overflow!您能否编辑您的问题以包含您当前正在处理的代码示例?这将有助于其他人给出量身定制的答案。

标签: python discord.py discord.py-rewrite


【解决方案1】:

您可以使用set_image() 函数将网址传递给您的图片,以将嵌入图片设置为您想要的。

embed = discord.Embed(title="Title", description="Description", color=0x00ff00)
embed.add_field(name="Field1", value="test", inline=False)
embed.set_image(url="https://url-to-your-picture.gif")
await message.channel.send(embed=embed)

参考资料:

【讨论】:

  • 你还能告诉如何显示哪个用户正在对哪个用户执行操作吗?非常感谢你
  • 如果您的命令类似于!kiss @user123,您可以从命令本身检索一个用户(将其作为函数定义中的预期参数传递),另一个从ctx.message.author 检索。
  • 那么message.author.name 会这样做吗?我对这一切都不熟悉?
  • 是的,另一个你可以通过将你的函数声明为async def kiss(self, ctx, user: discord.Member): 来获得它,它将是user.name
  • 你可以把它放在标题或描述中,这取决于你。
猜你喜欢
  • 2020-08-12
  • 2021-11-26
  • 2021-05-14
  • 2019-07-31
  • 2021-08-16
  • 2019-06-02
  • 2022-10-23
  • 1970-01-01
  • 2021-04-25
相关资源
最近更新 更多