【问题标题】:Getting an error while awaiting reaction using "wait_for" discord.py使用“wait_for”discord.py 等待反应时出错
【发布时间】:2021-06-20 02:37:11
【问题描述】:

在等待对机器人之前发送给用户 dms 的消息做出反应时收到此错误

reaction = await client.wait_for("reaction_add")
if str(reaction.emoji) == "1️⃣":
  await player.user.send("you have selected %s lol"%(members[0]))

Error:

'tuple' object has no attribute 'emoji'

【问题讨论】:

    标签: python async-await attributes tuples discord.py


    【解决方案1】:

    在等待响应时,wait_for 方法返回两个值 - discord.Reactiondiscord.User 实例。修复您的代码:

    reaction, user = await client.wait_for("reaction_add")
    

    【讨论】:

      猜你喜欢
      • 2021-06-22
      • 2019-07-10
      • 2021-06-27
      • 2019-08-22
      • 2021-08-13
      • 1970-01-01
      • 2020-08-25
      • 1970-01-01
      相关资源
      最近更新 更多