diff --git a/VocalMaisBot.py b/VocalMaisBot.py index 2516031..c11a61a 100755 --- a/VocalMaisBot.py +++ b/VocalMaisBot.py @@ -166,10 +166,19 @@ class VocalMaisBot(commands.Cog): # The user is not a bot and connected to one of our special watched channels # We create a channel for them and move them into it category = channel.category - user_name = user.display_name - user_channel = await category.create_voice_channel(f"{user_name}'s channel", overwrites = {user: discord.PermissionOverwrite(manage_channels = True)}) + # Creating the permissions of the channel + channel_permissions = category.overwrites # We base them on the category's permissions + if user not in channel_permissions: + channel_permissions[user] = discord.PermissionOverwrite() + channel_permissions[user].manage_channels = True # We allow the user for which we created the channel to change the channel's name + + # Computing the channel name + channel_name = f"{user.display_name}'s channel" + + # Creating the channel and moving the user into it + user_channel = await category.create_voice_channel(channel_name, overwrites = channel_permissions) await user.move_to(user_channel) - logger.info(f"[{channel.guild.name}({channel.guild.id})] Created channel {user_channel.name}({user_channel.id}) for {user.display_name}({user.id})") + logger.info(f"[{channel.guild.name}({channel.guild.id})] Created channel {user_channel.name}({user_channel.id}) for {user.name}#{user.discriminator}({user.id})") # Saving the channel in the configuration self.channels_config.add_channel_to_created(user_channel.guild, user_channel)