检查所有成员的自定义状态,而不仅仅是我的自定义状态

Check all members custom status instead of just my custom status

我如何更改此命令以检查服务器中所有成员的自定义状态,而不是仅检查编写该命令的人的自定义状态

有效的代码获得了我的自定义状态,即 test 并且它打印出来非常好。我只是想知道if/how我可以得到服务器中每个人的自定义状态。

@bot.command()
async def checkstatus(ctx):
    for status in ctx.author.activities:
        if isinstance(status, discord.CustomActivity):
            print(status)
Logged in as vanity#####
test

您可以在另一个 for 循环中遍历服务器 (ctx.guild) 中的所有成员。

@bot.command()
async def checkstatus(ctx):
    for member in ctx.guild.members: # for every member in the server,
        for status in member.activities: # for every status that member has..
            # then the rest of your code below

另请注意,您需要才能查看所有成员。

您要使用自助机器人吗?如果是,则他们反对 ToS,但您可以使用 discord.py-self