Discord.py Bot Add Reaction To a Message Python

Do you want to add the reaction to a specific message using Discord.py? This article will show you how to add a reaction to a specific message using Discord.py in Python.

So, you have been trying to make a bot using discord.py to add a reaction to a message once it has been read. But you keep getting errors one such error is CommandInvokeError.

This error usually occurs because you are trying to treat the string as a message object of discord. Let me show in the below example code how you can fix it and add a reaction to your message in discord.

How to Add Reaction to a Message using Discord.py in Python

You can use the below-mentioned method to get the reaction automatically with help of a discord bot on the message you want.

await bot.add_reaction(msg, emoji)

async def emoji(ctx):
    msg = await bot.say("Adding Reaction...")
    reactionList = ['pilot']
    for emoji in reactionList: 
        await bot.add_reaction(msg, emoji)

Using the above code you can successfully add a reaction to the discord message with help of a bot. And you can use the same code to automate your reactions to discord with help of a bot in Python.

Discord.py Bot Add Reaction To a Message Python

Wrap Up

I hope you were able to get to know how to add the reaction to a message using discord.py and how you can code it yourself for the different types of reactions you want.

Let me know if you have a better method than the one discussed above I will be happy to add it here.

If you liked the above tutorial then please follow us on Facebook and Twitter. Let us know the questions and answer you want to cover in this blog.

Further Read:

  1. Python Get The Minimum Value In Dictionary with Key
  2. How To Append Multiple Values To A List in Python
  3. How To Reboot or Restart Python Script
  4. Python: To Check If String Contains a Substring
  5. Python: How To Check If a String Contains a List of Substring
  6. How To Return Null in Python Discussed

Leave a Comment