我想对不和谐的邮件做出反应,然后它应该发送一个嵌入不和谐的邮件

时间:2020-08-24 21:39:59

标签: python encoding discord bots

if message.content.startswith('/overview'):
    embed = discord.Embed(title='**Overview**', description='This is a Overview for the Service! (easier then the manual methode)', color=16769251)
    embed.add_field(name='Create an Offer:', value='React on ✉️ to Create an own Offer')
    mess = await message.channel.send(embed=embed)
    await mess.add_reaction('✉️')

我用它来发送带有✉️的嵌入内容作为反应。

现在,我希望如果您做出反应,则该漫游器会在同一频道中发送新的嵌入消息。

1 个答案:

答案 0 :(得分:1)

您可以使用事件discord.on_raw_reaction_add,当在消息中添加反应时将调用该事件,例如:

@client.event
async def on_raw_reaction_add(payload):
    if payload.emoji.name == "✉️" and payload.user_id != client.user.id:
        embed = discord.Embed(
            description = "This embed was sent because you have reacted with ✉️ ",
            colour = discord.Colour.from_rgb(0, 255, 0)
        )
        channel = client.get_channel(payload.channel_id)
        message = await channel.fetch_message(payload.message_id)
        await message.channel.send(embed=embed)