def create(self, ctx, *channel_name):
"""Create a new voice channel with Supervisor permission."""
guild = ctx.guild
channel_name = " ".join(channel_name)
for channel in guild.voice_channels:
if channel.name == channel_name:
await self.bot_reply(ctx, 'Channel **{}** already exists, {}'.format(channel_name, ctx.author.mention))
return False
supervisor_role = None
for role in guild.roles:
if role.name == 'Supervisors':
supervisor_role = role
break
if supervisor_role is None:
return False
perms = {
supervisor_role: discord.PermissionOverwrite(manage_roles=True)
}
await guild.create_voice_channel(channel_name, overwrites=perms)
评论列表
文章目录