Search code examples
pythondiscorddiscord.pyembededit

How to edit discord embed... discord.py


I have question about my Embed. I have embed where users can get role with reactions. Problem is there that I want to add one more role but I don't want to ping again all roles because I'am using Carl-bot for those reactions. My question is how can I edit that embed without losing those reactions so I don't have to ping all roles again. I've tried to create command

if message.content.startswith("embededit"):
      channel = bot.get_channel(CHANNEL_ID)
      message = await bot.fetch_message(MESSAGE_ID)
      await message.edit(embed=embedEdit)

but it types that fetch_message doesn't exist or so. Thanks for any help! PS, I don't use bot.command because I don't know why but it doesn't work for me....


Solution

  • As @FinnE pointed out, your issue is with fetch_message(). You need to do await channel.fetch_message(MESSAGE_ID).

    if message.content.startswith("embededit"):
          channel = bot.get_channel(CHANNEL_ID)
          message = await channel.fetch_message(MESSAGE_ID)
          await message.edit(embed=embedEdit)