How to get count of all members in all voice channels discord.py

Andrii Krivoviazii

I tried to do this

            voicemembers_ = []
            for v in ctx.guild.voice_channels:
                voicemembers_.append(v.members)

            voicemembers = voicemembers_
            print(voicemembers)[0]

when wanted to find all members in all voice channels but I have 0 in terminal but in the server I have 10+ members also I delete [0] and add print statement and find this

[[], [], [], [], [], [], [<Member id=481824139133321218 name='Не ебался 15 лет' discriminator='3598' bot=False nick='M1sT' guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>, <Member id=509012843329486860 name='Wolfemor' discriminator='2311' bot=False nick=None guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>, <Member id=530380443577483264 name='Arkul' discriminator='8151' bot=False nick=None guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>, <Member id=938530532541751476 name='Gluko' discriminator='1219' bot=False nick='Стримлер' guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>], [], [], [], [], [], [], [], [], [], [], [<Member id=287215916817842188 name='ap0sstal' discriminator='6526' bot=False nick='ap0sstal(p0n1m3(Серж))' guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>, <Member id=371699181741539329 name='ArtemKKKa' discriminator='5882' bot=False nick='666' guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>], [], [], [<Member id=286883614921326594 name='321' discriminator='9099' bot=False nick='Aizen' guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>, <Member id=485010706316656640 name='G1R0' discriminator='7773' bot=False nick=None guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>, <Member id=576859761434296344 name='Aleg(tilt)' discriminator='5562' bot=False nick=None guild=<Guild id=938540650209615953 name='Ghost Side' shard_id=0 chunked=True member_count=345>>], []]
Eric Jin

You can use sets, which are fast, can be counted easily, and will also automatically filter out any duplicated members.

voice = set()
for v in ctx.guild.voice_channels:
    for member in v.members:
        voice.add(member.id)

Then, you can get the total number by doing len(voice). You can also iterate over all of the members if you want to do anything to it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Discord.py getting members in voice channels on all servers

How to get all text channels using discord.py?

how to get all members of a guild in discord.py?

Discord PY how to get list of all server members?

Get all users in voice channels with discord.js

Get all members discord.py

Make bot disconnect from all voice channels in all guilds? Discord.py

Get all text channels and change permissions in Discord.py

How do I get a list of all of the members in a discord server using discord.py

How do I get a list of all members in a discord server using the new discord.py version?

How do I get the user IDs of all the members in my discord server using python and discord.py?

how to change permissions for all text channels with discord.py?

Discord.py move all members from one voice channel to another

Get all the names of a server's members in discord.py

How do I get all members with a certain role discord.py

How to get a list of all non-bot members, rewriting Discord.py?

Discord.py - How can I get the amount of all members who are in a voicechannel with my bot?

Sending a message to all channels — Discord.py

Overwrite permissions for discord bot to mute a role in all text/voice channels

Discord.py - Trying to get number of channels, text channels & voice channels

How to make a bot join voice channels discord.py

How do I ignore certain voice channels? discord.py

Discord PY getting all members of a server

how to get all members id in discord.js

How to count the members returned by ALL

Is there a way to list all members of a discord server with discord.py

How would I convert my discord.py discord bots code that I use to get a list of members in a voice channel to the new discord.py version?

How to get count of all currently selected members of dimension

How to get member count of all members in every guild the bot is in