Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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

add reaction discord.py

await message.add_reaction(emoji)
Comment

add reaction discord.py


await bot.add_reaction(msg, emoji)

Comment

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

how to add reaction by message id in discord.py

#react command
@bot.command()
@commands.has_permissions(manage_messages=True)
async def react(ctx,emoji,message_id):
  channel = ctx.channel
  msg = await channel.fetch_message(message_id)
  await msg.add_reaction(emoji)
Comment

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:]
Comment

PREVIOUS NEXT
Code Example
Python :: best scraping package in python 
Python :: how to make a comment in python 
Python :: find array length in python 
Python :: Update All Python Packages On Windows 
Python :: python colored text into terminal 
Python :: pandas count show one column 
Python :: isodate in python 
Python :: pandas.get_dummies 
Python :: data must be 1-dimensional pd.dataframe 
Python :: Python program to find N largest elements from a list 
Python :: python how to get the angle between two points by only their x,y 
Python :: push in python 
Python :: python tkinter button image 
Python :: chi square test contingency table python 
Python :: matrix diagonal sum python 
Python :: python between inheritance and composition 
Python :: sphinx autodoc command 
Python :: how to strip whitespace in python 
Python :: how to open cmd and run code using python 
Python :: python for unity 
Python :: seaborn distribution plot for all columns 
Python :: strptime python 
Python :: function to remove punctuation in python 
Python :: np ignore divide by zero seterr 
Python :: python list index() 
Python :: select rows with multiple conditions pandas query 
Python :: python max value in list 
Python :: matplotlib default style 
Python :: tqdm 2 progress bars 
Python :: snapchat api in python 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =