Skip to content Skip to sidebar Skip to footer

Python Add Custom Reaction For Message

I want to add multiple custom reaction for multiple commands Or if we add reaction lists it will add random reactions from that lists. So how to do that. from discord.utils import

Solution 1:

You need to capture the message that you're sending, then call add_reaction on that message, not the message passed as an argument to on_message

from discord.utils import get

reactions = ['123', '456', '💖']

@commands.command(pass_context=True)
async def ping(self, ctx):
    msg = "Pong {0.author.mention}".format(ctx.message)
    reply = await self.bot.say(msg)
    for emoji_id in reactions:
        emoji = get(ctx.server.emojis, name=emoji_id)
        await bot.add_reaction(reply, emoji or emoji_id)  
        # If emoji is None, then emoji_id is likely a unicode emoji

Solution 2:

for r in reactions:
    await bot.add_reaction(message, r)

Post a Comment for "Python Add Custom Reaction For Message"