From 9914d77d526aa9f1f87c1980d91140aa9888f07f Mon Sep 17 00:00:00 2001 From: imcompiling Date: Sun, 2 Jul 2023 11:29:23 -0400 Subject: [PATCH] Start working on highcouncl election start message. --- bot_messages/highcouncil_election.txt | 13 +++++++++++++ classes/election_cycle.py | 21 ++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 bot_messages/highcouncil_election.txt diff --git a/bot_messages/highcouncil_election.txt b/bot_messages/highcouncil_election.txt new file mode 100644 index 0000000..50f5422 --- /dev/null +++ b/bot_messages/highcouncil_election.txt @@ -0,0 +1,13 @@ +`Leadership Elections - candidacy time` + + +<@&{clan_council_elect_role_id}>, welcome. We are starting the second part of our elections. On {highcouncil_election_announce} this channel will be open to write for all of you. Everyone else will be able to read this channel, but not write in it. Only members of the Clan Council Elected (CCE) can vote now. Any votes from others will be annulled. + +From {highcouncil_election_announce} to {highcouncil_election_start}, you will be able to announce your candidacy for High Council. The positions are: + Clan Leader + Discord Server Manager + +Each member of the CCE can cast one for each category by using the emotes: <:Rank_Owner:479008325137072155> for Clan Leader and <:Rank_Deputy:479008295319896064> for Discord Server Manager. +If needed, the icon 🤷 can be used to abstain to vote in any or both categories and it should be apply to all candidates of that category. + +Votes can be cast until the {highcouncil_election_end}, so we can announce and have everyone set up to start the term by {term_start} \ No newline at end of file diff --git a/classes/election_cycle.py b/classes/election_cycle.py index 22098e2..09f4e1d 100644 --- a/classes/election_cycle.py +++ b/classes/election_cycle.py @@ -35,7 +35,9 @@ class ElectionCycle: self.term_end: datetime = get_datetime(self.elecion_cycle.term_end) self.voting_start: datetime = get_datetime(self.elecion_cycle.voting_start) self.voting_end: datetime = get_datetime(self.elecion_cycle.voting_end) - self.highcouncil_election: datetime = self.voting_end + timedelta(days=1) + self.highcouncil_election_announce: datetime = self.voting_end + timedelta(days=1) + self.highcouncil_election_start: datetime = self.highcouncil_election_announce + timedelta(days=3) + self.highcouncil_election_end: datetime = self.term_start - timedelta(days=1) self.bot: commands.Bot = bot def build_election_announcement(self) -> list[str]: @@ -59,12 +61,25 @@ class ElectionCycle: term_end_date=self.term_end.strftime("%B %d"), voting_start_date=self.voting_start.strftime("%B %d"), voting_end_date=self.voting_end.strftime("%B %d"), - highcouncil_election_date=self.highcouncil_election.strftime("%B %d"), + highcouncil_election_date=self.highcouncil_election_start.strftime("%B %d"), next_election_start_date=next_election.strftime("%B %d"), ) return message.split("---message_break---") + def build_highcouncil_election(self) -> str: + """ + Builds message to announce highcouncil election start. + + Returns: + str: Message to send. + """ + + with open("bot_messages/highcouncil_election.txt", mode="r", encoding="utf8") as file: + message = file.read() + + return message.format() + def build_vote_start(self) -> str: """ Builds the voting start message out of template and configurations. @@ -98,7 +113,7 @@ class ElectionCycle: await self.voting_end_action() elif today.date() == self.voting_end.date(): await self.voting_end_action() - elif today.date() == self.highcouncil_election.date(): + elif today.date() == self.highcouncil_election_start.date(): await self.highcouncil_election_action() elif today.date() == self.term_start.date(): await self.term_start_action()