Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(discord.py) Getting a list of all of the members in a specific voice channel

So I'm attempting to write a raiding bot for my raiding discord using the discord.py library in python. This scripts is supposed to be forming a list of members in the voice channel for raiding. For some reason, this script is not working. Whenever memids is printed, it just prints an empty list.

If anyone is familiar with discord.py and could tell me why this isn't working, please do. It's really troubling me and I have tried everything in my knowledge to fix it.

#find raiding
        voice_channel = discord.utils.get(ctx.message.server.channels, id = '440014722587426816')

        #finds the members
        members = voice_channel.voice_members

        memids = []

        for member in members:
            memids.append(member.id)

        print(memids)
like image 385
Matthew Kopie Avatar asked Apr 29 '18 06:04

Matthew Kopie


People also ask

How do you count members in discord PY?

Enable Developer mode in Discord (User Settings -> Accessibility) then right click the server icon and click Copy ID, then type this line of code after async def: guild = client. get_guild(paste the copied ID here) Also you don't need len(guild. member_count) it will return number of digits of member count.

Can you be in multiple discord voice channels at once?

Unfortunately, Discord doesn't allow its users to be in 2 voice channels at once. You are only allowed to join 1 voice channel at a time. If you try to join a second server, you'll be asked to disconnect from the first voice channel you joined before you can connect with the second one.

How do you mention a voice channel discord PY?

Just do # and then start typing the channel name.

How many channels does discord voice have?

Also, one great feature in Discord's voice calls is how many people can participate. As mentioned, you can talk with up to 100 users at the same time.


1 Answers

If you know the id of the channel you can do it this way. Works for me :D

channel = client.get_channel(1234567890) #gets the channel you want to get the list from

members = channel.members #finds members connected to the channel

memids = [] #(list)
for member in members:
    memids.append(member.id)

print(memids) #print info
like image 171
RiveN Avatar answered Sep 20 '22 00:09

RiveN