Home python Discord.py How to get a list of participants online on the server...

Discord.py How to get a list of participants online on the server in Discord?

Author

Date

Category

I want to write a bot, which would bring a message to the console, when someone comes into the network on my digit server.
But I can not get participants online.
Member.Status returns “offline” for those who are online and not online. In the docks Discord Py, I did not find a function that would return only online users

import discord
from discord.ext import commands
INTENTS = Discord.intens.Default ()
INTENTS.MEMBERS = TRUE.
Token = 'My Bot Token'
Client = Discord.client (Intens = Intens)
@ Client.Event.
ASYNC DEF ON_REDY ():
    For Server In Client.Guilds:
      Print (Server)
    For Member in Server.members:
      Print (Member, "-", Member.Status)
Client.Run (Token)

Answer 1, Authority 100%

Here is a list of users online, IDLE, OFFLINE, DND

mbr = ctx.guild.members
Online = Len (List (Lambda X: X.Status == discord.status.online, MBRS)))
Idle = Len (List (Lambda X: X.Status == Discord.Status.idle, MBRS)))
Offline = Len (List (Lambda X: X.Status == discord.status.offline, MBRS)))
DND = LEN (LIST (LAMBDA X: X.Status == discord.status.dnd, mbr)))

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions