clean up election_cycle constructor.
This commit is contained in:
@@ -5,7 +5,6 @@ Contains the election cycle class
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import commands
|
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ class ElectionCycle:
|
|||||||
the cycle.
|
the cycle.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, cycle: int, bot: commands.Bot) -> None:
|
def __init__(self, cycle: int, config: DakinyConfig, guild: nextcord.Guild) -> None:
|
||||||
"""
|
"""
|
||||||
Generates all dates relevant to the election cycle from input election start, term start and end dates.
|
Generates all dates relevant to the election cycle from input election start, term start and end dates.
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ class ElectionCycle:
|
|||||||
term_end (datetime): Date the term being elected ends.
|
term_end (datetime): Date the term being elected ends.
|
||||||
bot: the discord bot instance
|
bot: the discord bot instance
|
||||||
"""
|
"""
|
||||||
self.config: DakinyConfig = bot.config
|
self.config: DakinyConfig = config
|
||||||
self.cycle = cycle
|
self.cycle = cycle
|
||||||
self.elecion_cycle = self.config.election_cycles[self.cycle]
|
self.elecion_cycle = self.config.election_cycles[self.cycle]
|
||||||
self.election_start: datetime = get_datetime(self.elecion_cycle.election_start)
|
self.election_start: datetime = get_datetime(self.elecion_cycle.election_start)
|
||||||
@@ -41,7 +40,7 @@ class ElectionCycle:
|
|||||||
self.highcouncil_election_announce: 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_start: datetime = self.highcouncil_election_announce + timedelta(days=3)
|
||||||
self.highcouncil_election_end: datetime = self.term_start - timedelta(days=1)
|
self.highcouncil_election_end: datetime = self.term_start - timedelta(days=1)
|
||||||
self.guild: nextcord.Guild = bot.get_guild(self.config.params.guild_id)
|
self.guild: nextcord.Guild = guild
|
||||||
|
|
||||||
def build_election_announcement(self) -> list[str]:
|
def build_election_announcement(self) -> list[str]:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user