Run ruff linter with autofixing.
This commit is contained in:
@@ -46,7 +46,6 @@ class ElectionCycle:
|
||||
config (DakinyConfig): The entire config object.
|
||||
guild (nextcord.Guild): The guild that this election is running in.
|
||||
"""
|
||||
|
||||
self.config: DakinyConfig = config
|
||||
self.cycle = cycle
|
||||
self.election_cycle = self.config.election_cycles[self.cycle]
|
||||
@@ -69,8 +68,7 @@ class ElectionCycle:
|
||||
list[str]: A list of message contents in the correct order. Must be a string because the message is too
|
||||
long.
|
||||
"""
|
||||
|
||||
with open(f"{TEMPLATES_DIR}/election_announcement.txt", mode="r", encoding="utf8") as file:
|
||||
with open(f"{TEMPLATES_DIR}/election_announcement.txt", encoding="utf8") as file:
|
||||
message = file.read()
|
||||
|
||||
next_election = get_datetime(
|
||||
@@ -98,8 +96,7 @@ class ElectionCycle:
|
||||
Returns:
|
||||
str: Message to send.
|
||||
"""
|
||||
|
||||
with open(f"{TEMPLATES_DIR}/highcouncil_election.txt", mode="r", encoding="utf8") as file:
|
||||
with open(f"{TEMPLATES_DIR}/highcouncil_election.txt", encoding="utf8") as file:
|
||||
message = file.read()
|
||||
|
||||
return message.format(
|
||||
@@ -117,8 +114,7 @@ class ElectionCycle:
|
||||
Returns:
|
||||
str: Message to send.
|
||||
"""
|
||||
|
||||
with open(f"{TEMPLATES_DIR}/highcouncil_vote.txt", mode="r", encoding="utf8") as file:
|
||||
with open(f"{TEMPLATES_DIR}/highcouncil_vote.txt", encoding="utf8") as file:
|
||||
message = file.read()
|
||||
|
||||
return message.format(
|
||||
@@ -133,8 +129,7 @@ class ElectionCycle:
|
||||
Returns:
|
||||
str: Message to send
|
||||
"""
|
||||
|
||||
with open(f"{TEMPLATES_DIR}/vote_start.txt", mode="r", encoding="utf8") as file:
|
||||
with open(f"{TEMPLATES_DIR}/vote_start.txt", encoding="utf8") as file:
|
||||
message = file.read()
|
||||
vote_end: datetime = get_datetime(self.config.election_cycles[self.cycle].voting_end)
|
||||
|
||||
@@ -226,7 +221,6 @@ class ElectionCycle:
|
||||
"""
|
||||
Performs required actions for when voting time 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)
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(self.get_election_info().ThreadId)
|
||||
@@ -278,7 +272,6 @@ class ElectionCycle:
|
||||
"""
|
||||
Performs required actions for when the highcouncil is elected.
|
||||
"""
|
||||
|
||||
message = self.build_highcouncil_vote_start()
|
||||
election_thread: nextcord.Thread = self.guild.get_thread(self.get_election_info().ThreadId)
|
||||
await election_thread.send(message)
|
||||
@@ -303,7 +296,6 @@ class ElectionCycle:
|
||||
"""
|
||||
Marks the election as over.
|
||||
"""
|
||||
|
||||
self.election_over = True
|
||||
|
||||
elect_role: nextcord.Role = self.guild.get_role(self.config.params.clan_council_elect_role_id)
|
||||
@@ -396,7 +388,6 @@ class ElectionCycle:
|
||||
Returns:
|
||||
ElectionInformation: The information from the database about the current election.
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation).where(
|
||||
ElectionInformation.ElectionCycle == get_election_name(self.config)
|
||||
@@ -407,7 +398,6 @@ class ElectionCycle:
|
||||
"""
|
||||
Sends a message to general chat reminder clan about election.
|
||||
"""
|
||||
|
||||
general: nextcord.TextChannel = self.guild.get_channel(self.config.params.general_channel_id)
|
||||
|
||||
message = f"Reminder to <@&{self.config.params.clan_member_role_id}>! Clan elections are happening! Head over "
|
||||
|
||||
Reference in New Issue
Block a user