Python Discord.py机器人状态未显示

Python Discord.py机器人状态未显示,python,discord,Python,Discord,因此,当我尝试向discord python bot添加状态时,它不会显示在discord上,当运行代码时不会显示错误,只是状态不会显示本身 #Connection to discord @client.event async def on_ready(): print({client.user}, 'has connected to Discord!') await client.change_presence(activity=discord.Activity(type=di

因此,当我尝试向discord python bot添加状态时,它不会显示在discord上,当运行代码时不会显示错误,只是状态不会显示本身

#Connection to discord
@client.event
async def on_ready():
    print({client.user}, 'has connected to Discord!')
    await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name='~help'))
如果有人知道这个问题的解决方法,请帮助

import discord
import os
import config
import sys



client = discord.Client()



@client.event
async def on_ready():
        print({client.user}, 'has connected to Discord!')
        await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name='~help'))

client.run(config.token)                        #imports token from the config.py
我在我的测试机器人中尝试了你的代码,它运行得非常好。我附上了下面的截图和上面的代码。不知道为什么它对你不起作用。[这是我的全部代码,中间或结尾没有附加任何额外内容]

注意:导入配置有我的令牌(因此它不是必需的导入)