Fix bug getting ElectionInformation object correctly.
build_develop / build (push) Successful in 1m31s
build_develop / build (push) Successful in 1m31s
This commit is contained in:
@@ -183,11 +183,13 @@ class ElectionCycle:
|
|||||||
message = self.build_vote_start()
|
message = self.build_vote_start()
|
||||||
clan_member_role: nextcord.Role = self.guild.get_role(self.config.params.clan_member_role_id)
|
clan_member_role: nextcord.Role = self.guild.get_role(self.config.params.clan_member_role_id)
|
||||||
election_channel: nextcord.TextChannel = 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, view=VoteView(self.config, self.guild))
|
await election_channel.send(message)
|
||||||
vote_msg = await election_channel.send(build_votes_str(self.config))
|
vote_msg = await election_channel.send(build_votes_str(self.config), view=VoteView(self.config, self.guild))
|
||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(ElectionInformation).where(ElectionCycle == get_election_cycle_name(self.config))
|
stmt = select(ElectionInformation).where(
|
||||||
|
ElectionInformation.ElectionCycle == get_election_cycle_name(self.config)
|
||||||
|
)
|
||||||
info = session.scalar(stmt)
|
info = session.scalar(stmt)
|
||||||
info.CouncilVoteMsgId = vote_msg.id
|
info.CouncilVoteMsgId = vote_msg.id
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class VoteSelect(nextcord.ui.StringSelect):
|
|||||||
vote_message_str = build_votes_str(self.config)
|
vote_message_str = build_votes_str(self.config)
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(ElectionInformation.CouncilVoteMsgId).where(
|
stmt = select(ElectionInformation.CouncilVoteMsgId).where(
|
||||||
ElectionCycle == get_election_cycle_name(self.config)
|
ElectionInformation.ElectionCycle == get_election_cycle_name(self.config)
|
||||||
)
|
)
|
||||||
vote_msg_id = session.scalar(stmt)
|
vote_msg_id = session.scalar(stmt)
|
||||||
vote_msg = await interaction.channel.fetch_message(vote_msg_id)
|
vote_msg = await interaction.channel.fetch_message(vote_msg_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user