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)
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)
discord.py check if message has certain reaction
emoji = "" # some emoji as a string
if any(reaction.emoji == emoji for reaction in message.reactions):
# there is at least one reaction of the specified emoji
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)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us