'Discord.py move all members from one voice channel to another
I made two working bot commands, one that get id's from users connected to a voice channel and the other one move single members to another channel. How can i automate the process? I need to move every member without typing the username on discord chat
Thanks in advance
@bot.command()
async def move(ctx, channel : discord.VoiceChannel, *members: discord.Member):
for member in members:
await member.move_to(channel)
@bot.command()
async def people(ctx):
channel = bot.get_channel(ID_HERE)
member_ids = list(channel.voice_states.keys())
return member_ids
#*members should get member_ids
Solution 1:[1]
You can just create another command from which you call the other two functions:
@bot.command()
async def moveAll(ctx, channel:discord.VoiceChannel):
members_connected = await people(ctx) #Get the people
for member_id in people_connected:
member = await ctx.guild.fetch_member(member_id)
await member.move_to(channel)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |