【问题标题】:Increasing number when reacting to message (Discord.py)对消息做出反应时数量增加(Discord.py)
【发布时间】:2021-08-30 14:38:37
【问题描述】:

当某个人对我的机器人发送的不和谐消息做出反应时,我一生无法弄清楚如何使 json 文件中的变量增加(该反应已经由不和谐机器人做出如果这很重要)。

【问题讨论】:

  • variable_name+=1 工作吗?
  • 请附上你的代码/到目前为止你做了什么。

标签: python-3.x discord discord.py


【解决方案1】:

您可以使用on_reaction_add 事件

@client.event
async def on_reaction_add(reaction, user):
    if reaction.message.id == your_message_id:
        if reaction.emoji == your_emoji:
            # update the number

【讨论】:

    猜你喜欢
    • 2019-05-24
    • 1970-01-01
    • 1970-01-01
    • 2020-10-29
    • 1970-01-01
    • 1970-01-01
    • 2020-11-07
    • 1970-01-01
    • 2021-02-22
    相关资源
    最近更新 更多