如何获取此人已做出反应的消息文本。 Discord.py

How to get the text of the message to which the person has put a reaction. Discord.py

如何获取此人做出反应的消息文本?可能吗?

@client.event
async def on_raw_reaction_add(payload):
    emoji = payload.emoji.name
    if emoji == "":
        print(msg)

是的,payload allows you to get the message ID

然后您可以通过获取频道然后获取消息将其转换为消息。如果您不想这样做,您应该只使用正常的反应添加事件,它提供实际消息 class(但仅当消息被缓存时 - 参见 here)。

@client.event
async def on_raw_reaction_add(payload):
    emoji = payload.emoji.name
    if emoji == "":
        message = await client.get_channel(payload.channel_id).fetch_message(payload.message_id)
        print(message.content)
        # prints message content, or do whatever you need