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


i use :

import discord 

i need each voice channel amount users , names (usernames). how it?

you need access voice channel object. recommend use voice channel's id. command follows:

@client.command(pass_context = true) async def vcmembers(ctx, voice_channel_id):     #first getting 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 not valid voice channel.")      members = voice_channel.voice_members     member_names = '\n'.join([x.name 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 work this:

enter image description here

where number @ end channel id. if don't know how channel id, right click channel , click copy id.

enter image description here

if can't see copy id, turn on developer mode in settings > appearance > developer mode


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -