[英]How can I edit an embed color with my discord bot with discord.py
为了好玩,我一直在开发一个不和谐的机器人。 我想知道如何使用 edit_message 来更改消息的嵌入颜色。
这是我的代码:
@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:命令引发异常:AttributeError:'Bot'对象没有属性'edit_message'
您使用的是哪个版本的 discord.py? 您的代码看起来像是为 v0.16 或更早版本编写的。
在 v1.0.0 之后,您将使用Message.edit()
await msg.edit(embed=em2)
您是否也尝试使用“u”进行颜色处理,例如:color=0xFF0000
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.