Discord.py 将所有成员从一个语音通道移动到另一个
Discord.py move all members from one voice channel to another
我做了两个有效的机器人命令,一个从连接到语音通道的用户那里获取 ID,另一个将单个成员移动到另一个通道。
我怎样才能使这个过程自动化?我需要移动每个成员而不用在不和谐的聊天中输入用户名
提前致谢
@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
您可以创建另一个命令,从中调用其他两个函数:
@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)
我做了两个有效的机器人命令,一个从连接到语音通道的用户那里获取 ID,另一个将单个成员移动到另一个通道。 我怎样才能使这个过程自动化?我需要移动每个成员而不用在不和谐的聊天中输入用户名
提前致谢
@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
您可以创建另一个命令,从中调用其他两个函数:
@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)