【问题标题】:Discord.py `on_user_update` does not work, even with intents enabledDiscord.py `on_user_update` 不起作用,即使启用了意图
【发布时间】:2021-06-12 08:12:50
【问题描述】:

当他们更新他们的头像/用户名/鉴别器时,我试图打印用户名 + 鉴别器,但是当我更新我自己的用户名、头像或鉴别器时没有任何反应。我还确保在https://discord.com/developers/applications/(my application id)/bot 上启用意图我的代码是:

import discord


intents = discord.Intents().all()

client = discord.Client(Intents=intents)



@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))



@client.event
async def on_user_update(before, after):
    print(str(after))


client.run('my token')

【问题讨论】:

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


    【解决方案1】:

    关键字参数区分大小写,客户端意图配置的关键字参数是intents,而不是Intents。所以客户端实例必须是:

    client = discord.Client(intents=intents)
    

    【讨论】:

      猜你喜欢
      • 2023-03-14
      • 2020-04-17
      • 2011-10-30
      • 2021-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多