为什么我的代码不起作用?
@bot.event
async def on_ready():
print('Bot is now working!')
await bot.change_presence(activity=discord.CustomActivity(name='Custom status' ,emoji='?'))
Run Code Online (Sandbox Code Playgroud)
并给我一个错误。
Ignoring exception in on_ready
Traceback (most recent call last):
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
await coro(*args, **kwargs)
File "main.py", line 30, in on_ready
await bot.change_presence(activity=discord.CustomActivity(name='Custom status' ,emoji='?'))
AttributeError: module 'discord' has no attribute 'CustomActivity'
Run Code Online (Sandbox Code Playgroud)
错误是如何修复的?