MCSasha Asked:2024-01-04 23:34:58 +0000 UTC2024-01-04 23:34:58 +0000 UTC 2024-01-04 23:34:58 +0000 UTC @client.event 不起作用,以红色突出显示 772 如果我写@client.event,它会以红色突出显示 @client.event async def on_message(message): print(message.content) 在这种情况下,@client.event 以红色斜体突出显示,请告诉我如何解决此问题。 python 1 个回答 Voted Best Answer Magan 2024-01-06T03:33:29Z2024-01-06T03:33:29Z 拥有所有代码就太好了。但假设该变量client不存储类对象discord.Client或discord.ext.commands.Bot 检查上面的代码client。这是一个例子: client = discord.Client(intents=discord.Intents.all()) 或者如果您想使用机器人: from discord.ext import commands client = commands.Bot("!", intents=discord.Intents.all()) 请注意,我使用了所有意图,如果您不使用所有意图,请更改此设置
拥有所有代码就太好了。但假设该变量
client不存储类对象discord.Client或discord.ext.commands.Bot检查上面的代码client。这是一个例子:或者如果您想使用机器人:
请注意,我使用了所有意图,如果您不使用所有意图,请更改此设置