【问题标题】:I need help sending embedded messages我需要帮助发送嵌入式消息
【发布时间】:2019-11-08 14:11:04
【问题描述】:

我正在尝试使用 discord.py 制作一个用于不和谐的机器人,该机器人使用嵌入消息回复 !help。我在其他地方看到过这个问题的答案,但是每当我运行这段代码时,python 都会崩溃。我使用打印和评论来确定问题行是底部,我发送消息的位置。有什么建议吗?

        if message.content == ('{}help'.format(prefix)):
            embed = discord.Embed(title="Title", description="Desc", color=0x00ff00)
            embed.add_field(name="Field1", value="hi", inline=True)
            embed.add_field(name="Field2", value="hi2", inline=True)
            print(embed)
            await message.channel.send(embed=embed)

【问题讨论】:

  • python 崩溃是什么意思?是否抛出错误?
  • 哦,抱歉,我之前确实想通了,忘记更新了。显然我很笨,忘记在频道中启用权限-_-。顺便说一句,我没有使用 ide 来编辑它,我只是使用官方的 python 应用程序,它不会抛出错误,它只是终止。

标签: python discord discord.py


【解决方案1】:

您是否成功让机器人发送任何其他消息?当我在测试机器人中运行您的代码时,它工作得很好。也许您的机器人在当前频道中没有消息发送权限?

Example bot response

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-12
    • 2021-04-25
    • 2018-04-29
    • 2014-01-19
    相关资源
    最近更新 更多