S
S
senyadev02019-01-21 21:37:19
Python
senyadev0, 2019-01-21 21:37:19

Discord API. How to display the game the user is playing?

There is a discord.py library. I went through the documentation and found Member.game - discordpy.readthedocs.io/en/latest/api.html#discord.Member.game
But I still don't understand how to use this method. Is there any way to output the game the user is playing?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sudo rm -rf /, 2019-01-22
@senyadev0

Learn to express yourself more clearly.
To get the current status text (also known as "game name") from a server visitor , the Member.game field can be used .
If you want to change the status of the bot itself , then you need to use the Client.change_status(...) method .

await client.change_status(game=Game(name="Я не умею в гугл"))

A
alternativshik, 2019-01-21
@alternativshik

yes, make a request to this API method, get the game and output.

R
Renat Grishin, 2021-02-03
@CynVox

sudo rm -rf / painted correctly, only the discord API has changed a little and now the game activity of users is stored in a different place.
guild.presences.cache.activities - here is an object with the name of the game, activity type, etc...

let selectUser = msg.guild.members.cache.find(member => member.user.id == IDПользователя);
selectUser.guild.presences.cache.map(prs=>console.log(prs.activities))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question