【问题标题】:Discord Bot Python Having it create embdedsDiscord Bot Python 让它创建嵌入
【发布时间】:2021-11-06 10:55:04
【问题描述】:

您好,我想知道如何让我的不和谐机器人在 python 中允许用户在文本聊天中创建嵌入并发布它。就像 carl bot 一样。谢谢!

【问题讨论】:

  • discord.py has been discontinued. 请寻找其他图书馆。
  • @DavidCulbreth 他为什么要寻找/寻找另一个图书馆? discord.py 根本不再开发,但仍然可以使用。因此,问题就在这里,您的评论无助于回答。
  • @Dominik,出于与避免使用 Python 2 相同的原因,它不再接收与实际 Discord API 的安全性或兼容性的更新。应用程序中已经有 discord.py 不支持的功能。该库的一些分支正在积极开发中,但名称不同。
  • @DavidCulbreth 实际上,嗯,我仍然可以使用 discord.py,并且到目前为止它运行良好。 discord.py 的开发者自己帮助创建它的创始人实际上正在努力更新它以及其他编码器
  • 我没有说它不可用,只是它不再被维护。它的其他分支正在开发中,但 discord.py 本身现在已存档在 GitHub 上,这意味着无法将新内容推送到存储库。通过继续使用该版本的软件,您将面临潜在的未来安全漏洞,并且当库与 Discord 本身不兼容时会彻底失败。

标签: python discord discord.py bots


【解决方案1】:

这里有一个使用 discord.ext.commands 制作的示例

@client.command()
async def make_embed(ctx):
    def check(message):
        return message.author == ctx.author and message.channel == ctx.channel

    await ctx.send('Waiting for a title')
    title = await client.wait_for('message', check=check)
  
    await ctx.send('Waiting for a description')
    desc = await client.wait_for('message', check=check)

    embed = discord.Embed(title=title.content, description=desc.content, color=0x72d345)
    await ctx.send(embed=embd)

【讨论】:

  • 快速跟进问题我将如何解决允许用户在嵌入中插入他们想要的特定颜色
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-11-23
  • 2021-08-12
  • 2020-08-02
  • 2021-04-26
  • 2019-03-23
  • 2019-04-19
  • 2020-07-14
相关资源
最近更新 更多