Added discord bot to class.

This commit is contained in:
2023-05-13 12:59:40 -04:00
parent f62f88113d
commit d3858a7ba1
+15 -11
View File
@@ -4,6 +4,8 @@ Contains the election cycle class
from datetime import datetime, timedelta
from nextcord.ext import commands
class ElectionCycle:
"""
@@ -11,7 +13,7 @@ class ElectionCycle:
the cycle.
"""
def __init__(self, election_start: datetime, term_start: datetime, term_end: datetime) -> None:
def __init__(self, election_start: datetime, term_start: datetime, term_end: datetime, bot) -> None:
"""
Generates all dates relevant to the election cycle from input election start, term start and end dates.
@@ -19,13 +21,15 @@ class ElectionCycle:
election_start (datetime): Date the election cycle starts.
term_start (datetime): Date the term being elected starts.
term_end (datetime): Date the term being elected ends.
bot: the discord bot instance
"""
self.election_start: datetime = election_start
self.term_start: datetime = term_start
self.term_end: datetime = term_end # might not be needed
self.voting_start: datetime = self.election_start + timedelta(days=7)
self.voting_end: datetime = self.voting_start + timedelta(days=7)
self.highcouncil_election: datetime = self.voting_end + timedelta(days=1)
self._election_start: datetime = election_start
self._term_start: datetime = term_start
self._term_end: datetime = term_end # might not be needed
self._voting_start: datetime = self._election_start + timedelta(days=7)
self._voting_end: datetime = self._voting_start + timedelta(days=7)
self._highcouncil_election: datetime = self._voting_end + timedelta(days=1)
self._bot: commands.Bot = bot
def check_date(self) -> None:
"""
@@ -35,13 +39,13 @@ class ElectionCycle:
# check all dates if action is needed
match today.date():
case self.election_start.date():
case self._election_start.date():
self.election_start_action()
case self.voting_start.date():
case self._voting_start.date():
self.voting_end_action()
case self.voting_end.date():
case self._voting_end.date():
self.voting_end_action()
case self.highcouncil_election.date():
case self._highcouncil_election.date():
self.highcouncil_election_action()
def election_start_action(self) -> None: