如何使用discord bot编辑嵌入颜色不和.py

2024-04-28 00:07:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在研究一个不和谐的机器人。我想知道如何使用edit_消息来更改消息的嵌入颜色。在

这是我的代码:

@bot.command()
async def test(self):
    """Embed color changing"""
    em1 = discord.Embed(title="Red", colour=0xFF0000)
    msg = await self.message.channel.send(embed=em1)
    em2 = discord.Embed(title="Green", colour=0x00FF00)
    await self.bot.edit_message(msg, embed=em2)

当我运行该命令时,出现以下错误:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'edit_message'


Tags: self消息messagetitlebot机器人msgembed