为了账号安全,请及时绑定邮箱和手机立即绑定

更改 discord.py 机器人状态

更改 discord.py 机器人状态

人到中年有点甜 2021-09-28 13:59:38
对我来说可能很难,但我相信 stackoverflow 的力量,我需要在我的机器人上输入一个数字作为机器人状态。这里:http : //gamers-control-2.000webhostapp.com/count.txt#time to show status = 在空白网站上创建的文本 = "41"# http://gamers-control-2.000webhostapp.com/count.txt#some how,你说我可以输入数字,我说网络中的数字每次都会改变,所以我需要获取该数字以将其显示为机器人状态。import discordfrom discord.ext.commands import Botfrom discord.ext import commandsimport asyncioimport timeimport randomfrom discord import GameClient = discord.clientclient = commands.Bot(command_prefix = '!')Clientdiscord = discord.Client()@client.eventasync def on_ready(): await client.change_presence(game=discord.Game(name=http://gamers-control-2.000webhostapp.com/count.txt, type=3)) print('test ready')client.run("....")我是 discord.py 的新手
查看完整描述

3 回答

?
jeck猫

TA贡献1909条经验 获得超7个赞

这是我使用的


async def on_ready():

    print(f'We have logged in as {bot.user}')

    print('Ready!')

    return await bot.change_presence(activity=discord.Activity(type=3, name='Add status here'))```



查看完整回答
反对 回复 2021-09-28
  • 3 回答
  • 0 关注
  • 175 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号