【问题标题】:I'm new to python and can't figure how to make a status changer for a discord bot我是 python 新手,不知道如何为不和谐机器人制作状态更改器
【发布时间】:2020-03-10 20:05:34
【问题描述】:

所以我有一个可以显示状态的代码(在底部),但我是 python 和脚本的新手,有人帮忙吗?

我试过这样做 =

@client.event
async def on_ready()
    await client_presence(activity=discord.Activity(name= "test1", "test2", "test3", type=discord.ActivityType.watching))

但这当然没有用,因为它只是要使用“test1”,现在我不知道该怎么做,所以我来到这里!

@client.event
async def on_ready():
      await client.change_presence(activity=discord.Activity(name="You type !help | Made by Iharvested, type !baselink to obtain me!", type=discord.ActivityType.watching))

【问题讨论】:

标签: python discord.py


【解决方案1】:

如果您要求一种方法来无限循环一堆不同的状态,这是您最好的选择。

statusList = ["test1", "test2", "test3"]

@client.event
async def on_ready():
    while True:
        for status in statusList:
            await client.change_presence(activity=discord.Activity(name=status, type=discord.ActivityType.watching))

【讨论】:

    猜你喜欢
    • 2020-03-19
    • 1970-01-01
    • 2021-06-10
    • 2021-11-10
    • 2019-10-03
    • 2021-06-25
    • 2022-10-24
    • 2021-10-30
    • 2021-05-27
    相关资源
    最近更新 更多