diff --git a/GameFiles/Game.py b/GameFiles/Game.py index 5de2127..014cb71 100644 --- a/GameFiles/Game.py +++ b/GameFiles/Game.py @@ -332,15 +332,11 @@ class Game: async def create_player_channels(): create_player_channel_tasks = [] - # Discord channel positions are not relative to the category and not necessarily absolute, but a channel in same category than another with a higher - # position attribute will be sorted lower. - # See https://github.com/Rapptz/discord.py/issues/2392#issuecomment-707455919 - observer_channel_position = self.get_observer_channel().position async def create_player_channel(player: discord.Member, channel_position: int): perms = { self.guild.default_role: discord.PermissionOverwrite(read_messages = False), - player: discord.PermissionOverwrite(read_messages = True), + player: discord.PermissionOverwrite(read_messages = True, manage_messages = True), # Allow the player to pin messages in its own channel gm_role: discord.PermissionOverwrite(read_messages = True), observer_role: discord.PermissionOverwrite(read_messages = True, send_messages = False), } @@ -349,6 +345,10 @@ class Game: logger.debug(f"[{self.guild.name}] Created channel for player {player.name}") asyncio.create_task(player_channel.send(f"Hello! This is your private channel.\nIn here you can cast your votes, interact with the <@&{self.get_gm_role_id()}>, and write freely.\nHave a nice game!", allowed_mentions = discord.AllowedMentions(roles = True))) + # Discord channel positions are not relative to the category and not necessarily absolute, but a channel in same category than another with a higher + # position attribute will be sorted lower. + # See https://github.com/Rapptz/discord.py/issues/2392#issuecomment-707455919 + observer_channel_position = self.get_observer_channel().position for i, player in enumerate(self.get_players()): create_player_channel_tasks.append(asyncio.create_task(create_player_channel(player, observer_channel_position + i + 1))) await asyncio.wait(create_player_channel_tasks)