Setting bitrate and user limit of created channel based on joined channel

This commit is contained in:
Elnath 2021-02-09 23:07:41 +01:00
parent d66bd81413
commit 129e21d1b1
1 changed files with 5 additions and 1 deletions

View File

@ -257,9 +257,13 @@ class VocalMaisBot(commands.Cog):
user_default_channel_name = "{user}'s channel" user_default_channel_name = "{user}'s channel"
channel_name = discord_utils.voice_channel_safe_name(user_default_channel_name, user_name_replacement = user.display_name) channel_name = discord_utils.voice_channel_safe_name(user_default_channel_name, user_name_replacement = user.display_name)
# We set bitrate and user limit for the new channel the same as the channel that has been joined to create
bitrate = channel.bitrate
user_limit = channel.user_limit
# Creating the channel and moving the user into it # Creating the channel and moving the user into it
logger.debug(f"[{discord_utils.to_string(channel.guild)}] Creating channel {channel_name} for {discord_utils.to_string(user)}") logger.debug(f"[{discord_utils.to_string(channel.guild)}] Creating channel {channel_name} for {discord_utils.to_string(user)}")
user_channel = await category.create_voice_channel(channel_name, overwrites = channel_permissions) user_channel = await category.create_voice_channel(channel_name, overwrites = channel_permissions, bitrate = bitrate, user_limit = user_limit)
await user.move_to(user_channel) await user.move_to(user_channel)
logger.info(f"[{discord_utils.to_string(channel.guild)}] Created channel {discord_utils.to_string(user_channel)} for {discord_utils.to_string(user)}") logger.info(f"[{discord_utils.to_string(channel.guild)}] Created channel {discord_utils.to_string(user_channel)} for {discord_utils.to_string(user)}")