Python 反应日志显示消息作者的姓名,而不是作出反应的人的姓名(discord.py)
我正在discord.py中处理一个机器人,我正在尝试在我的机器人日志中创建一个反应日志,但它不是说做出反应的人,而是说消息作者。有人能帮我吗 这是我的密码:Python 反应日志显示消息作者的姓名,而不是作出反应的人的姓名(discord.py),python,discord.py,Python,Discord.py,我正在discord.py中处理一个机器人,我正在尝试在我的机器人日志中创建一个反应日志,但它不是说做出反应的人,而是说消息作者。有人能帮我吗 这是我的密码: @client.event async def on_reaction_add(reaction, user): message = reaction.message channel = message.guild.get_channel(812838695169949727) embed=discord.Embe
@client.event
async def on_reaction_add(reaction, user):
message = reaction.message
channel = message.guild.get_channel(812838695169949727)
embed=discord.Embed(title="{} added a reaction!".format(message.author.name), description="", color=0xffa500)
embed.add_field(name="This is the channel:", value=str(message.channel), inline=False)
embed.add_field(name="This is the message:", value=message.content, inline=True)
embed.add_field(name="This is the reaction:", value=str(reaction), inline=True)
await channel.send(embed=embed)
reaction.message.author
是邮件的原始作者。作出反应的用户是“reaction\u add事件处理程序”中的user
参数,因此要获得他们的名字,应该使用user.name
而不是第五行的message.author.name
。reaction.message.author
是消息的原始作者。作出反应的用户是\u reaction\u add
事件处理程序上的user
参数,因此要获取他们的名字,您应该使用user.name
而不是第5行的message.author.name