General rework to the voting views.
build_develop / build (push) Successful in 1m31s

This commit is contained in:
2023-11-03 11:55:57 -04:00
parent fa3284b9e3
commit 14f2e13772
3 changed files with 40 additions and 23 deletions
+11 -3
View File
@@ -11,8 +11,8 @@ from sqlalchemy.orm import Session
from classes.nominate_views import NominateView
from classes.voting_views import VoteView
from config import DakinyConfig
from database_setup.sql_data_classes import CouncilMembers, ElectionInformation, Votes, engine
from utils import get_datetime, get_election_cycle_name
from database_setup.sql_data_classes import ElectionInformation, engine
from utils import build_votes_str, get_datetime, get_election_cycle_name
class ElectionCycle:
@@ -183,7 +183,15 @@ 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: nextcord.TextChannel = self.guild.get_channel(self.get_election_info().ElectionChannel)
await election_channel.send(message, view=VoteView())
await election_channel.send(message, view=VoteView(self.config, self.guild))
vote_msg = await election_channel.send(build_votes_str(self.config))
with Session(engine) as session:
stmt = select(ElectionInformation).where(ElectionCycle == get_election_cycle_name(self.config))
info = session.scalar(stmt)
info.CouncilVoteMsgId = vote_msg.id
session.commit()
await election_channel.set_permissions(clan_member_role, send_messages=False)
async def voting_end_action(self) -> None: