def _massmove(self, ctx, from_channel, to_channel):
"""Internal function: Massmove users to another voice channel"""
# check if channels are voice channels. Or moving will be very... interesting...
type_from = str(from_channel.type)
type_to = str(to_channel.type)
if type_from == 'text':
await self.bot.say('{} is not a valid voice channel'.format(from_channel.name))
log.debug('SID: {}, from_channel not a voice channel'.format(from_channel.server.id))
elif type_to == 'text':
await self.bot.say('{} is not a valid voice channel'.format(to_channel.name))
log.debug('SID: {}, to_channel not a voice channel'.format(to_channel.server.id))
else:
try:
log.debug('Starting move on SID: {}'.format(from_channel.server.id))
log.debug('Getting copy of current list to move')
voice_list = list(from_channel.voice_members)
for member in voice_list:
await self.bot.move_member(member, to_channel)
log.debug('Member {} moved to channel {}'.format(member.id, to_channel.id))
await asyncio.sleep(0.05)
except discord.Forbidden:
await self.bot.say('I have no permission to move members.')
except discord.HTTPException:
await self.bot.say('A error occured. Please try again')
评论列表
文章目录