“Cómo agregar reacción por ID de mensaje en Discord.py” Código de respuesta

discord.py Agregar reacción al mensaje

#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)
Delightful Donkey

cómo detectar la reacción a un mensaje 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)
Alert Armadillo

Agregar reacción discord.py

await message.add_reaction(emoji)
Jittery Jaguar

Obtenga reacciones de 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:]
Clever Caterpillar

Cómo agregar reacción por ID de mensaje en 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)
Hunter 87

Respuestas similares a “Cómo agregar reacción por ID de mensaje en Discord.py”

Preguntas similares a “Cómo agregar reacción por ID de mensaje en Discord.py”

Más respuestas relacionadas con “Cómo agregar reacción por ID de mensaje en Discord.py” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código