【问题标题】:Is there anyway to change discord.py bot's status from streaming to playing?有没有办法将 discord.py 机器人的状态从流式更改为播放?
【发布时间】:2021-05-14 14:51:05
【问题描述】:

我正在制作一个不和谐的机器人,并为我的机器人做出了改变状态。无论如何,我可以将机器人的流媒体活动更改为播放吗?这是代码:-

@client.event
async def on_ready():
  client.loop.create_task(status_task())
  print("Bot is Ready!)

async def status_task():
    while True:
        await client.change_presence(activity=discord.Streaming(name="stream", url='https://www.twitch.tv/discord'))

        await asyncio.sleep(30) 
        await client.change_presence(activity=discord.Streaming(name="!help", url='https://www.twitch.tv/discord'))
        await asyncio.sleep(30)
        await client.change_presence(activity=discord.Activity(type=discord.ActivityType.playing, name="a game"))
        await asyncio.sleep(30)

【问题讨论】:

    标签: discord discord.py


    【解决方案1】:

    你可以使用discord.Game

    await client.change_presence(activity=discord.Game(name='a game')
    

    参考资料:

    【讨论】:

      猜你喜欢
      • 2019-05-26
      • 2020-11-24
      • 2021-04-02
      • 2016-07-19
      • 1970-01-01
      • 2011-02-28
      • 2023-03-28
      • 2021-07-06
      • 2011-12-22
      相关资源
      最近更新 更多