diff --git a/classes/election_cycle.py b/classes/election_cycle.py index 8eac21b..6cd6946 100644 --- a/classes/election_cycle.py +++ b/classes/election_cycle.py @@ -435,7 +435,7 @@ class ElectionCycle: await vote_msg.edit(view=None) highcouncil_msg: str = ( - f"Congratulations for our high council members!\n Clan Leader: <@{cl_winner}>\n" + f"Congratulations for our high council members!\nClan Leader: <@{cl_winner}>\n" ) highcouncil_msg += f"Discord Manager: <@{dm_winner}>" await election_thread.send(highcouncil_msg) diff --git a/classes/voting_highcouncil_views.py b/classes/voting_highcouncil_views.py index 2a36b70..f52ef5b 100644 --- a/classes/voting_highcouncil_views.py +++ b/classes/voting_highcouncil_views.py @@ -34,16 +34,6 @@ class VoteSelect(nextcord.ui.StringSelect): self.election_type = election_type async def callback(self, interaction: Interaction): - # decide on election type - match self.election_type: - case "cl": - election_type: str = VoteType.CLANLEADER - case "dm": - election_type: str = VoteType.DISCORDMANAGER - case _: - # should never happen - raise ValueError('election type was not "cl" or "dm"') - election_name: str = get_election_name(self.config) with Session(engine) as session: stmt = select(ElectionInformation.HighCouncilVoteMsgId).where( @@ -60,7 +50,7 @@ class VoteSelect(nextcord.ui.StringSelect): ElectionCycle=election_name, VoterId=interaction.user.id, VotedForId=voted_for, - Type=election_type, + Type=self.election_type, ) try: @@ -74,7 +64,7 @@ class VoteSelect(nextcord.ui.StringSelect): update(Votes) .where(Votes.ElectionCycle == election_name) .where(Votes.VoterId == interaction.user.id) - .where(Votes.Type == election_type) + .where(Votes.Type == self.election_type) .values(VotedForId=voted_for) ) session.execute(stmt) @@ -173,7 +163,9 @@ class VoteHighcouncilView(nextcord.ui.View): view = nextcord.ui.View() view.add_item( - VoteSelect(options=options, config=self.config, election_type="cl") + VoteSelect( + options=options, config=self.config, election_type=VoteType.CLANLEADER + ) ) await interaction.response.send_message( @@ -251,7 +243,11 @@ class VoteHighcouncilView(nextcord.ui.View): view = nextcord.ui.View() view.add_item( - VoteSelect(options=options, config=self.config, election_type="dm") + VoteSelect( + options=options, + config=self.config, + election_type=VoteType.DISCORDMANAGER, + ) ) await interaction.response.send_message(