diff --git a/bot_messages/election_announcement.txt b/bot_messages/election_announcement.txt index d38fe62..e014931 100644 --- a/bot_messages/election_announcement.txt +++ b/bot_messages/election_announcement.txt @@ -34,16 +34,16 @@ The Clan Council will be denoted by the Discord ranks of <@&{clan_council_id}> a <:Rank_Owner:479008325137072155> Clan Leader ---message_break--- __Here's the timeline:__ -Election begins: {election_start_date} -Term: {term_start_date} - {term_end_date} +Election begins: {election_start} +Term: {term_start} - {term_end} -**{election_start_date}**: Post here to announce candidacy -**{voting_start_date}**: Voting begins -**{voting_end_date}**: Votes are tallied and winners are announced -**{highcouncil_election_date}**: The new Clan Council votes who among them shall receive the two High Council positions of: Clan Leader and Discord Server Manager. -**{term_start_date}**: The new Clan Council is officially inaugurated and a drop party (or a giveaway event) begins to commemorate the new leadership. +**{election_start}**: Post here to announce candidacy +**{voting_start}**: Voting begins +**{voting_end}**: Votes are tallied and winners are announced +**{highcouncil_election}**: The new Clan Council votes who among them shall receive the two High Council positions of: Clan Leader and Discord Server Manager. +**{term_start}**: The new Clan Council is officially inaugurated and a drop party (or a giveaway event) begins to commemorate the new leadership. -This process will begin again next quarter on {next_election_start_date} with the inauguration scheduled for {term_end_date}. +This process will begin again next quarter on {next_election_start} with the inauguration scheduled for {term_end}. ---message_break--- **You may now announce your candidacy for a seat on the Dakiny Clan Council! ** diff --git a/bot_messages/vote_start.txt b/bot_messages/vote_start.txt index d8662ba..f67865e 100644 --- a/bot_messages/vote_start.txt +++ b/bot_messages/vote_start.txt @@ -2,7 +2,7 @@ <@&{clan_member_id}>, it's time to vote for clan council. React with <{voting_emote_id}> to vote. -Voting ends next {voting_end_day}, {voting_end_date}. +Voting ends next {voting_end_day}, {voting_end}. Results will then be announced. After a candidate receives 3 votes, their spot is secured in the new council, but you can still vote for them to show your support. diff --git a/classes/election_cycle.py b/classes/election_cycle.py index 13b654e..67d8742 100644 --- a/classes/election_cycle.py +++ b/classes/election_cycle.py @@ -2,7 +2,7 @@ Contains the election cycle class """ -from datetime import datetime, timedelta +from datetime import datetime import nextcord from sqlalchemy import select @@ -20,6 +20,7 @@ class ElectionCycle: """ def __init__(self, cycle: int, config: DakinyConfig, guild: nextcord.Guild) -> None: + # TODO update """ Generates all dates relevant to the election cycle from input election start, term start and end dates. @@ -37,9 +38,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_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.highcouncil_election_announce: datetime = get_datetime(self.elecion_cycle.highcouncil_election_announce) + self.highcouncil_election_start: datetime = get_datetime(self.elecion_cycle.highcouncil_election_start) + self.highcouncil_election_end: datetime = get_datetime(self.elecion_cycle.highcouncil_election_end) self.guild: nextcord.Guild = guild self.election_over: bool = False @@ -60,13 +61,13 @@ class ElectionCycle: message = message.format( clan_council_id=self.config.params.clan_council_role_id, high_council_id=self.config.params.high_council_role_id, - election_start_date=self.election_start.strftime("%B %d"), - term_start_date=self.term_start.strftime("%B %d"), - 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_start.strftime("%B %d"), - next_election_start_date=next_election.strftime("%B %d"), + election_start=self.election_start.strftime("%B %d"), + term_start=self.term_start.strftime("%B %d"), + term_end=self.term_end.strftime("%B %d"), + voting_start=self.voting_start.strftime("%B %d"), + voting_end=self.voting_end.strftime("%B %d"), + highcouncil_election=self.highcouncil_election_start.strftime("%B %d"), + next_election_start=next_election.strftime("%B %d"), ) return message.split("---message_break---") @@ -87,7 +88,7 @@ class ElectionCycle: 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"), + term_start=self.term_start.strftime("%B %d"), ) def build_highcouncil_vote_start(self) -> str: @@ -103,7 +104,7 @@ class ElectionCycle: return message.format( clan_council_elect_role_id=self.config.params.clan_council_elect_role_id, - term_start_date=self.term_start.strftime("%B %d"), + term_start=self.term_start.strftime("%B %d"), ) def build_vote_start(self) -> str: @@ -121,7 +122,7 @@ class ElectionCycle: return message.format( clan_member_id=self.config.params.clan_member_role_id, voting_emote_id=self.config.params.voting_emote_id, - voting_end_date=vote_end.strftime("%B %d"), + voting_end=vote_end.strftime("%B %d"), voting_end_day=vote_end.strftime("%A"), ) @@ -135,7 +136,7 @@ class ElectionCycle: if today.date() == self.election_start.date(): await self.election_start_action() elif today.date() == self.voting_start.date(): - await self.voting_end_action() + await self.voting_start_action() elif today.date() == self.voting_end.date(): await self.voting_end_action() elif today.date() == self.highcouncil_election_start.date(): diff --git a/cogs/loops/daily_loop.py b/cogs/loops/daily_loop.py index 6b47fa1..665647f 100644 --- a/cogs/loops/daily_loop.py +++ b/cogs/loops/daily_loop.py @@ -81,7 +81,7 @@ class DailyLoop(commands.Cog, name="Daily Loop"): for cycle, election in enumerate(config.election_cycles): if ( today.date() >= get_datetime(election.election_start).date() - and today.date() < get_datetime(election.term_start).date() + and today.date() <= get_datetime(election.term_start).date() ): current_election = ElectionCycle(cycle, config, self.bot.get_guild(config.params.guild_id)) diff --git a/config.py b/config.py index 9e00c7d..9f31c11 100644 --- a/config.py +++ b/config.py @@ -31,6 +31,9 @@ class ElectionCycle: """ election_start: str + highcouncil_election_announce: str + highcouncil_election_end: str + highcouncil_election_start: str name: str term_end: str term_start: str