P
P
prostiti2021-08-12 11:23:57
Python
prostiti, 2021-08-12 11:23:57

How to check user status?

This code recognizes only all statuses except the user one.
How to make the bot be able to determine another user status?

t = member.status
    if t == discord.Status.online:
        d = "<:online2:842130462038425653> В сети"
    elif t == discord.Status.offline:
        d = "<:offline2:842130438209536000> Не в сети"
    elif t == discord.Status.idle:
        d = "<:away:842130479339667497> Не активен"
    elif t == discord.Status.dnd:
        d = "<:dnd2:842130417406181436> Не беспокоить"
    elif t == discord.Status.streaming:
        d = "<:streaming:846048619571314719> Стримит"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Endora Blackwell, 2021-08-12
@Allan-BlackWell

In discord.py, it is assumed that a user can have 3 types of statuses (Mobile, Web and Desktop)
Try this:

if str(member.status) == 'online':
     d = "<:online2:842130462038425653> В сети"
elif str(member.status) == 'idle':
     d = "<:away:842130479339667497> Не активен"
elif str(member.status) == 'dnd':
     d = "<:dnd2:842130417406181436> Не беспокоить"
elif str(member.status) == 'offline':
     d  = "<:offline2:842130438209536000> Не в сети"
elif str(member.status) == "streaming":
    d = "<:streaming:846048619571314719> Стримит"

M
Maxim Nevzorov, 2021-08-15
@fixator10

Custom statuses - a kind of "activity" (games, rich presence, etc..)

discord.utils.get(author.activities, type=discord.ActivityType.custom)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question