Merge branch '15-term-start-action'

This commit is contained in:
2023-07-25 15:30:45 -04:00
+10 -11
View File
@@ -142,8 +142,6 @@ class ElectionCycle:
await self.highcouncil_election_start_action()
elif today.date() == self.term_start.date():
await self.term_start_action()
elif today.date() == self.term_end.date():
await self.term_end_action()
async def election_start_action(self) -> None:
"""
@@ -154,7 +152,7 @@ class ElectionCycle:
quarter_name: str = self.get_election_cycle_name()
# create new entry into database.
election_channel = await category.create_text_channel(quarter_name)
election_channel: nextcord.TextChannel = await category.create_text_channel(quarter_name)
with Session(engine) as session:
new_cycle = ElectionInformation(ElectionCycle=quarter_name, ElectionChannel=election_channel.id)
session.add(new_cycle)
@@ -175,7 +173,7 @@ class ElectionCycle:
"""
message = self.build_vote_start()
clan_member_role: nextcord.Role = self.guild.get_role(self.config.params.clan_member_role_id)
election_channel = self.guild.get_channel(self.get_election_info().ElectionChannel)
election_channel: nextcord.TextChannel = self.guild.get_channel(self.get_election_info().ElectionChannel)
await election_channel.send(message)
await election_channel.set_permissions(clan_member_role, send_messages=False)
@@ -185,7 +183,7 @@ class ElectionCycle:
"""
message = self.build_highcouncil_election_announce()
council_elect_role: nextcord.Role = self.guild.get_role(self.config.params.clan_council_elect_role_id)
election_channel = self.guild.get_channel(self.get_election_info().ElectionChannel)
election_channel: nextcord.TextChannel = self.guild.get_channel(self.get_election_info().ElectionChannel)
await election_channel.send(message)
await election_channel.set_permissions(council_elect_role, send_messages=True)
@@ -195,16 +193,17 @@ class ElectionCycle:
"""
message = self.build_highcouncil_vote_start()
election_channel = self.guild.get_channel(self.get_election_info().ElectionChannel)
election_channel: nextcord.TextChannel = self.guild.get_channel(self.get_election_info().ElectionChannel)
await election_channel.send(message)
async def term_start_action(self) -> None:
msg: str = "the term has started"
print(msg)
"""
Moves the election channel into the archive category.
"""
election_channel: nextcord.TextChannel = self.guild.get_channel(self.get_election_info().ElectionChannel)
archive: nextcord.CategoryChannel = self.guild.get_channel(self.config.params.archive_channel_group_id)
async def term_end_action(self):
msg: str = "the term has ended"
print(msg)
await election_channel.move(beginning=True, category=archive)
def get_election_cycle_name(self) -> str:
"""