[Solved] How to get the sum and the names of all the users from all voice channels Disocrd?


You need to access the voice channel object. I recommend you use the voice channel’s id. The command could look as follows:

@client.command(pass_context = True)
async def vcmembers(ctx, voice_channel_id):
    #First getting the voice channel object
    voice_channel = discord.utils.get(ctx.message.server.channels, id = voice_channel_id)
    if not voice_channel:
        return await client.say("That is not a valid voice channel.")

    members = voice_channel.voice_members
    member_names="\n".join([x.name for x in members])

    embed = discord.Embed(title = "{} member(s) in {}".format(len(members), voice_channel.name),
                          description = member_names,
                          color=discord.Color.blue())

    return await client.say(embed = embed)

And would work like this:

enter image description here

Where the number at the end is the channel id. If you don’t know how to get the channel id, right click the channel and click Copy ID.

enter image description here

If you can’t see the Copy ID, turn on Developer Mode in your Settings > Appearance > Developer Mode

1

solved How to get the sum and the names of all the users from all voice channels Disocrd?