From 5cb9be7e37c573404740a5a1eff23cf829ed4be2 Mon Sep 17 00:00:00 2001 From: imcompiling Date: Tue, 25 Jul 2023 14:16:00 -0400 Subject: [PATCH 1/2] Fill out build_highcouncil_election_announce --- classes/election_cycle.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/classes/election_cycle.py b/classes/election_cycle.py index 36514dd..060ca7c 100644 --- a/classes/election_cycle.py +++ b/classes/election_cycle.py @@ -71,7 +71,7 @@ class ElectionCycle: return message.split("---message_break---") - def build_highcouncil_election(self) -> str: + def build_highcouncil_election_announce(self) -> str: """ Builds message to announce highcouncil election start. @@ -82,7 +82,13 @@ class ElectionCycle: with open("bot_messages/highcouncil_election.txt", mode="r", encoding="utf8") as file: message = file.read() - return message.format() + return message.format( + clan_council_elect_role_id=self.config.params.clan_council_elect_role_id, + highcouncil_election_announce=self.highcouncil_election_announce.strftime("%B %d"), + highcouncil_election_start=self.highcouncil_election_start.strftime("%B %d"), + highcouncil_election_end=self.highcouncil_election_end.strftime("%B %d"), + term_start_date=self.term_start.strftime("%B %d"), + ) def build_vote_start(self) -> str: """ From 1c76e6806cc8f333c933d7b14047aee5a6b718e8 Mon Sep 17 00:00:00 2001 From: imcompiling Date: Tue, 25 Jul 2023 14:37:41 -0400 Subject: [PATCH 2/2] Build and send announcement. Change permissions. --- classes/election_cycle.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/classes/election_cycle.py b/classes/election_cycle.py index 060ca7c..b45f44d 100644 --- a/classes/election_cycle.py +++ b/classes/election_cycle.py @@ -172,7 +172,16 @@ class ElectionCycle: """ Performs required actions for when voting time has ended. """ - print("voting has ended") + message = self.build_highcouncil_election_announce() + council_elect_role: nextcord.Role = self.guild.get_role(self.config.params.clan_council_elect_role_id) + with Session(engine) as session: + stmt = select(ElectionInformation).where( + ElectionInformation.ElectionCycle == self.get_election_cycle_name() + ) + election_info = session.scalar(stmt) + election_channel = self.guild.get_channel(election_info.ElectionChannel) + await election_channel.send(message) + await election_channel.set_permissions(council_elect_role, send_messages=True) async def highcouncil_election_action(self) -> None: """