From 13cc41dadd86201f5ba51a67e96e41eb1d629fdd Mon Sep 17 00:00:00 2001 From: Simon Junod Date: Wed, 27 Apr 2022 17:14:17 +0200 Subject: [PATCH] Adding basic poll functionality --- cambot/polls.py | 23 +++++++++++++++++++++++ run.py | 1 - 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 cambot/polls.py diff --git a/cambot/polls.py b/cambot/polls.py new file mode 100644 index 0000000..0ba3ef3 --- /dev/null +++ b/cambot/polls.py @@ -0,0 +1,23 @@ +import nextcord + +class Poll: + def __init__(self): + self.message = None + self.owner = None + self.intro = None + self.options = {} + +class Button(nextcord.ui.Button): + def __init__(self, owner): + super().__init__(label=f"Supprimer le sondage ({owner.display_name} uniquement)", + emoji="\N{cross mark}") + self.owner = owner + + async def callback(self, interaction): + if interaction.user == self.owner: + await interaction.message.delete() + +class ButtonView(nextcord.ui.View): + def __init__(self, owner): + super().__init__() + self.add_item(Button(owner=owner)) \ No newline at end of file diff --git a/run.py b/run.py index 69e78aa..fb4041c 100755 --- a/run.py +++ b/run.py @@ -13,7 +13,6 @@ from cambot.settings import * bot = nextcord.Client() codenames_games = {} -wordle_games = {} # Startup @bot.event