如何通过discord.py获取Discord用户自定义状态?
我看过 discord.py 文档。我唯一能找到的是Member.status
返回状态为:在线/离线/空闲/dnd。
但不是新的自定义状态值。 我也不是在搜索自定义状态。
答案 0 :(得分:3)
您想要的是 CustomActivity
。
正如文档中所解释的,一个用户可以有多个活动,但请尝试一下:
@bot.command()
async def mycustomstatus(ctx):
for s in ctx.author.activities:
if isinstance(s, discord.CustomActivity):
await ctx.send(s)
稍微相关的说明:请记住,截至撰写此答案时,bots cannot set custom activities;只阅读它们。
编辑:
如果您无法获取会员的活动,请确保您已启用特权意图:
import discord
intents = discord.Intents().all()
bot = commands.Bot(command_prefix=..., intents=intents)