M
M
menma_uzumakie2022-04-05 18:38:56
Python
menma_uzumakie, 2022-04-05 18:38:56

Why is activity tracking not working in the Discord.py card?

Constantly writes that he is not online, although the user is just online

@bot.command()
async def info(ctx,member:discord.Member = None, guild: discord.Guild = None):
    await ctx.message.delete()
    if member == None:
        emb = discord.Embed(title="Информация о пользователе", color=ctx.message.author.color)
        emb.add_field(name="Имя:", value=ctx.message.author.display_name,inline=False)
        emb.add_field(name="Айди пользователя:", value=ctx.message.author.id,inline=False)
        t = ctx.message.author.status
        if t == discord.Status.online:
            d = " В сети"

        t = ctx.message.author.status
        if t == discord.Status.offline:
            d = "⚪ Не в сети"

        t = ctx.message.author.status
        if t == discord.Status.idle:
            d = " Не активен"

        t = ctx.message.author.status
        if t == discord.Status.dnd:
            d = " Не беспокоить"

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Georgy Kharitonov, 2022-04-05
@NoGrisha

Try like this:

t = ctx.message.author.status

if str(t) == 'online':
    d = "✅В сети"

    if member.is_on_mobile():
        d = "✅В сети\nС телефона"

elif str(t) == 'offline':
    d = " Не в сети"

elif str(t) == 'idle':
     d = "Неактивен"

 elif str(t) == 'dnd':
      d = "Не беспокоить"

Indentation can be a problem.

W
Wolf_Yout, 2022-04-06
@Wolf_Yout

On the developers page, in the Bot tab, enable:
624d4f13b1d15358169060.png
Next, where you bot = commands.Bot(replace with this:

bot = commands.Bot(command_prefix="Your Prefix", intents=discord.Intents.all())

B
Bogdan Buchko, 2022-04-06
@INDMops

I had a similar issue . See my code and explanations in the comments.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question