Add channel for Nona and Ennea

This commit is contained in:
Yohann D'ANELLO 2021-11-13 16:00:08 +01:00
parent dcd4fd6026
commit 9fcfa3f8bc
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 27 additions and 2 deletions

View File

@ -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)

View File

@ -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