From 9fcfa3f8bc6ccc32d82f9884904f55a07c946488 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 13 Nov 2021 16:00:08 +0100 Subject: [PATCH] Add channel for Nona and Ennea --- orochi/bot.py | 28 ++++++++++++++++++++++++++-- orochi/config.py | 1 + 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/orochi/bot.py b/orochi/bot.py index 4efa42d..63f1dae 100644 --- a/orochi/bot.py +++ b/orochi/bot.py @@ -181,6 +181,30 @@ async def on_ready(): dan, overwrite=PermissionOverwrite(read_message_history=True, read_messages=True) ) + if not config.sisters_channel: + channel: TextChannel = await secret_category.create_text_channel("sista") + config.sisters_channel = channel.id + config.save() + + sisters_channel: TextChannel = await guild.fetch_channel(config.sisters_channel) + if not sisters_channel: + config.sisters_channel = None + return await on_ready() + + await sisters_channel.edit(name="sista", category=secret_category, position=3, + topic="Discussions vestimentaires") + await sisters_channel.set_permissions( + guild.default_role, overwrite=PermissionOverwrite(read_message_history=False, read_messages=False) + ) + nona = guild.get_role(config.player_roles['nona']) + ennea = guild.get_role(config.player_roles['ennea']) + await sisters_channel.set_permissions( + nona, overwrite=PermissionOverwrite(read_message_history=True, read_messages=True) + ) + await sisters_channel.set_permissions( + ennea, overwrite=PermissionOverwrite(read_message_history=True, read_messages=True) + ) + config.save() @@ -480,7 +504,7 @@ async def reboot(ctx: commands.Context): class VoteView(disnake.ui.View): @disnake.ui.button(label="S'allier", style=disnake.ButtonStyle.green) - async def confirm(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction): + async def ally(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction): if Game.INSTANCE.state != GameState.VOTING: return await interaction.response.send_message("Les votes ne sont pas ouverts.", ephemeral=True) @@ -489,7 +513,7 @@ class VoteView(disnake.ui.View): await self.vote(interaction, Vote.ALLY) @disnake.ui.button(label="Trahir", style=disnake.ButtonStyle.red) - async def cancel(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction): + async def betray(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction): if Game.INSTANCE.state != GameState.VOTING: return await interaction.response.send_message("Les votes ne sont pas ouverts.", ephemeral=True) diff --git a/orochi/config.py b/orochi/config.py index f59eb28..118531c 100644 --- a/orochi/config.py +++ b/orochi/config.py @@ -27,6 +27,7 @@ class Config: telepathy_channel: int = None brother_channel: int = None brother_channel_webhook: int = None + sisters_channel: int = None player_roles: dict[str, int] = field(default_factory=dict) http_host: str = '127.0.0.1' http_port: int = 5000