2017-07-28 1 views

Répondre

1

Vous devez accéder à l'objet Voix. Je vous recommande d'utiliser l'identifiant du canal vocal. La commande pourrait se présenter comme suit:

@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) 

Et travaillerait comme ceci:

enter image description here

Lorsque le numéro à la fin est l'identifiant du canal. Si vous ne savez pas comment obtenir l'identifiant de la chaîne, faites un clic droit sur la chaîne et cliquez sur Copier l'ID.

enter image description here

Si vous ne pouvez pas voir l'ID de copie, activez le mode développeur dans votre Settings > Appearance > Developer Mode