简体   繁体   English

Discord.py 状态每 10 分钟更改一次时出错

[英]Discord.py Error While Status Changing every 10 minutes

Hi so im making a bot that changes the status every 10 minutes or so with different activites.嗨,我正在制作一个机器人,它每 10 分钟左右通过不同的活动改变状态。 Only problem its givng me a strange error.唯一的问题是它给了我一个奇怪的错误。 I tried changing Activit to Activity but it will give me a Runtime Error saying the task was launched and not completed.我尝试将 Activit 更改为 Activity 但它会给我一个运行时错误,说任务已启动但未完成。 Then i have to run one of the bots commands again and it will post the message but it still wont change the status Code:然后我必须再次运行其中一个机器人命令,它会发布消息,但它仍然不会更改状态代码:

@client.event
async def on_ready():
    activity.start()

@tasks.loop(minutes=10)
async def activity():
 await client.change_presence(activity=discord.Activit(type=discord.ActivityType.watching, name=data))
Error:
  File "main.py", line 38, in activity
    await client.change_presence(activity=discord.Activit(type=discord.ActivityType.watching, name=parsing_data))
AttributeError: module 'discord' has no attribute 'Activit'

Change the "discord.activit" to discord.Activity.将“discord.activit”更改为 discord.Activity。 You've made a typo in your code.您在代码中打错了字。 I think the error clearly says that.我认为错误清楚地说明了这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM