为什么我的代码不起作用?
@bot.event
async def on_ready():
print('Bot is now working!')
await bot.change_presence(activity=discord.CustomActivity(name='Custom status' ,emoji='🖥️'))
并给我一个错误。
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'
错误如何修复?
原文由 loncer 发布,翻译遵循 CC BY-SA 4.0 许可协议
我迟到了,WayToDoor 是对的,机器人不能使用自定义状态,我发现他们“可以使用它”但它是不可见的,除了机器人可以看到它是自定义状态,你会在机器人配置文件。
机器人可以播放、观看、收听和流式传输没问题
您现在也可以选择使用类型 5 的“Competing in”。我还没有在文档中看到它,所以我假设它还没有实现。
这应该工作。