我需要从他的私人频道获得用户的反应。这是正确的做法吗?
@bot.event
async def on_raw_reaction_add(payload):
reactioneer = payload.member
emoji = payload.emoji
if emoji.name == "?":
msg = await reactioneer.send("Hi! Which greeting would you like to hear every morning? Click the reaction of it. Hello - 1, Morning - 2...")
await msg.add_reaction(:one:)
await msg.add_reaction(:two:)
def check(user, payload):
return user == payload.member and message.channel.type == discord.ChannelType.private
await bot.wait_for("payload", check = check)
### some things with data bases (does not matter now)
await reactioneer.send("Alright, I will send this greeting every morning!")
答案 0 :(得分:1)
await bot.wait_for("raw_reaction_add", check=check)
bot.wait_for()
等待 WebSocket event 被分派。