简体   繁体   English

Discord.py 如何获取用户的自定义状态?

[英]Discord.py how to get a users' custom status?

I'm making a small bot for me and my friends to play around with it a little, but since I am new to python and especially discord.py, I have a small question.我正在为我和我的朋友制作一个小机器人来玩它,但由于我是 python 的新手,尤其是 discord.py,我有一个小问题。 How do I get the custom status from a specific user?如何从特定用户获取自定义状态? I've only seen how to get the game activity or the online status and after quite some googleing I still haven't found what I'm looking for.我只看到了如何获得游戏活动或在线状态,经过相当多的谷歌搜索后,我仍然没有找到我要找的东西。 I hope you can help me!我希望你可以帮助我!

By looking at the discord.Member class, you can see that member has attributes status & raw_status so you can chose the prefeded one by writing通过查看discord.Member类,您可以看到该成员具有属性status & raw_status因此您可以通过编写来选择 prefed 一个

status = member.status
raw_status = member.raw_status

You can also use activity or activities for user's rich presence/activity您还可以使用activityactivities来获取用户丰富的存在/活动

activity = member.activity
activities = member.activities

You can get all of the activities of a Member via Member.activities .您可以通过Member.activities获取Member所有活动。 Whether it is a CustomActivity or anything else.无论是CustomActivity还是其他任何东西。 Every activity that a Member has will shown up in the Member.activities . Member每项活动都将显示在Member.activities But unfortunately, we can't access a User 's activities.但不幸的是,我们无法访问User的活动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM