Monday, 7 September 2020

How to get users status from the discord API (URL)

I'm trying to get status of a user without using any discord API language (eg. discord.py discord.js). The problem I'm having is getting a user from the discord API doesn't return the users status, how could I retrieve this information?

import urllib.request as req

headers = {'Authorization': f"Bot " + "YOUR BOT TOKEN"}

with req.urlopen(req.Request("https://discord.com/api/users/<USER ID>", headers = headers )) as get:
    print(get.read())

# Now getting the user through a server
with req.urlopen(req.Request("https://discord.com/api/guilds/<GUILD ID>/members/<USER ID>", headers = headers)) as get:
    print(get.read())

Both when ran return users information like ID, name, etc. But don't include the user status which I'm trying to get



from How to get users status from the discord API (URL)

No comments:

Post a Comment