Answers for "get reactions from message discord.py"

9

discord.py add reaction to message

#1
message = ctx.send("text")
#2
message = channel.send("text")
#3
message = channel.fetch_message(messageid)
#add reaction to message
emoji = '\N{THUMBS UP SIGN}'
await message.add_reaction(emoji)
Posted by: Guest on September-27-2020
0

how to detect the reaction to a message discord.py

@client.event
async def on_message(message):
    #if the spotify command is triggered
        #fetch from the API
        spotifyEmbed = discord.Embed(title=resultName, ...)
        spotifyEmbed.set_image(url=spotifyImgUrl)
        spotifyMessage = await message.channel.send(embed=spotifyEmbed)
        await spotifyMessage.add_reaction("⬅️")
        await spotifyMessage.add_reaction("➡️")

@client.event
async def on_reaction_add(reaction, user):
    if user != client.user:
        if str(reaction.emoji) == "➡️":
            #fetch new results from the Spotify API
            newSearchResult = discord.Embed(...)
            await reaction.message.edit(embed=newSearchResult)
        if str(reaction.emoji) == "⬅️":
            #fetch new results from the Spotify API
            newSearchResult = discord.Embed(...)
            await reaction.message.edit(embed=newSearchResult)
Posted by: Guest on June-27-2021
0

get reactions from message discord.py

#Get reactions from cached msg
cache_msg = discord.utils.get(client.cached_messages, id=msg.id)
n_players = await cache_msg.reactions[0].users().flatten()
n_players = n_players[1:]
Posted by: Guest on August-20-2021

Code answers related to "get reactions from message discord.py"

Python Answers by Framework

Browse Popular Code Answers by Language