我正在制作一个功能,如果用户点击特定表情符号并打印他的新昵称,它会更改用户的昵称。
@bot.event
async def on_raw_reaction_add(payload):
channel = bot.get_channel(payload.channel_id)
msg = await channel.fetch_message(payload.message_id)
emoji = payload.emoji
author = payload.member
if channel.id == channel_test_id:
def check(m):
return m.author == ???.author
await channel.send("Enter your new nickname")
msg2 = await bot.wait_for("message", check = check)
await author.edit(nick = msg2.content)
那么,可以这样做吗?
答案 0 :(得分:1)
def check(m):
return m.author == payload.member # Or simply `author` cause you made a variable like that
注意:如果事件不在公会内部调用,则 payload.member
可以是 None
。
了解属性 here