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:
where number @ end channel id. if don't know how channel id, right click channel , click copy id.
if can't see copy id, turn on developer mode in settings > appearance > developer mode


Comments
Post a Comment