小编lon*_*cer的帖子

如何制作自定义状态discord.py

为什么我的代码不起作用?

@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)

错误是如何修复的?

python python-3.x discord discord.py

2
推荐指数
2
解决办法
2万
查看次数

标签 统计

discord ×1

discord.py ×1

python ×1

python-3.x ×1