0
votes

I've been working on a discord bot for fun. I was wondering how I could use edit_message to change the embed color of the message.

Here is my code:

@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)

When I run the command I get this error:

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

2

2 Answers

1
votes

Which version of discord.py are you using? Your code looks like it was written for v0.16 or older.

After v1.0.0 you would use Message.edit()

await msg.edit(embed=em2)

-1
votes

also did you try color with the "u" like: color=0xFF0000