Removed references to ElectionChannel.
Removed permission managing as threads don't have permissions.
This commit is contained in:
+13
-35
@@ -220,14 +220,11 @@ class ElectionCycle:
|
|||||||
Removes write permission from the general clan member role.
|
Removes write permission from the general clan member role.
|
||||||
"""
|
"""
|
||||||
message = self.build_vote_start()
|
message = self.build_vote_start()
|
||||||
clan_member_role: nextcord.Role = self.guild.get_role(
|
election_thread: nextcord.Thread = self.guild.get_thread(
|
||||||
self.config.params.clan_member_role_id
|
self.get_election_info().ThreadId
|
||||||
)
|
)
|
||||||
election_channel: nextcord.TextChannel = self.guild.get_channel(
|
await election_thread.send(message)
|
||||||
self.get_election_info().ElectionChannel
|
vote_msg = await election_thread.send(
|
||||||
)
|
|
||||||
await election_channel.send(message)
|
|
||||||
vote_msg = await election_channel.send(
|
|
||||||
build_votes_str(self.config), view=VoteView(self.config, self.guild)
|
build_votes_str(self.config), view=VoteView(self.config, self.guild)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -240,8 +237,6 @@ class ElectionCycle:
|
|||||||
info.CouncilVoteMsgId = vote_msg.id
|
info.CouncilVoteMsgId = vote_msg.id
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
await election_channel.set_permissions(clan_member_role, send_messages=False)
|
|
||||||
|
|
||||||
async def voting_end_action(self) -> None:
|
async def voting_end_action(self) -> None:
|
||||||
"""
|
"""
|
||||||
Performs required actions for when voting time has ended.
|
Performs required actions for when voting time has ended.
|
||||||
@@ -251,11 +246,8 @@ class ElectionCycle:
|
|||||||
council_elect_role: nextcord.Role = self.guild.get_role(
|
council_elect_role: nextcord.Role = self.guild.get_role(
|
||||||
self.config.params.clan_council_elect_role_id
|
self.config.params.clan_council_elect_role_id
|
||||||
)
|
)
|
||||||
election_channel: nextcord.TextChannel = self.guild.get_channel(
|
election_thread: nextcord.Thread = self.guild.get_thread(
|
||||||
self.get_election_info().ElectionChannel
|
self.get_election_info().ThreadId
|
||||||
)
|
|
||||||
clan_member_role: nextcord.Role = self.guild.get_role(
|
|
||||||
self.config.params.clan_member_role_id
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# remove vote button from vote message
|
# remove vote button from vote message
|
||||||
@@ -265,7 +257,7 @@ class ElectionCycle:
|
|||||||
ElectionInformation.ElectionCycle == election_name
|
ElectionInformation.ElectionCycle == election_name
|
||||||
)
|
)
|
||||||
vote_msg_id = session.scalar(stmt)
|
vote_msg_id = session.scalar(stmt)
|
||||||
vote_msg: nextcord.Message = await election_channel.fetch_message(vote_msg_id)
|
vote_msg: nextcord.Message = await election_thread.fetch_message(vote_msg_id)
|
||||||
await vote_msg.edit(view=None)
|
await vote_msg.edit(view=None)
|
||||||
|
|
||||||
# add the highcouncil role to everyone with 3 or more votes. set elected to true in database
|
# add the highcouncil role to everyone with 3 or more votes. set elected to true in database
|
||||||
@@ -288,11 +280,7 @@ class ElectionCycle:
|
|||||||
|
|
||||||
await user.add_roles(council_elect_role)
|
await user.add_roles(council_elect_role)
|
||||||
|
|
||||||
await election_channel.send(message)
|
await election_thread.send(message)
|
||||||
await election_channel.set_permissions(
|
|
||||||
council_elect_role, send_messages=True, add_reactions=True
|
|
||||||
)
|
|
||||||
await election_channel.set_permissions(clan_member_role, add_reactions=False)
|
|
||||||
|
|
||||||
async def highcouncil_election_start_action(self) -> None:
|
async def highcouncil_election_start_action(self) -> None:
|
||||||
"""
|
"""
|
||||||
@@ -300,25 +288,17 @@ class ElectionCycle:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
message = self.build_highcouncil_vote_start()
|
message = self.build_highcouncil_vote_start()
|
||||||
election_channel: nextcord.TextChannel = self.guild.get_channel(
|
election_thread: nextcord.Thread = self.guild.get_thread(
|
||||||
self.get_election_info().ElectionChannel
|
self.get_election_info().ThreadId
|
||||||
)
|
)
|
||||||
await election_channel.send(message)
|
await election_thread.send(message)
|
||||||
|
|
||||||
async def term_start_action(self) -> None:
|
async def term_start_action(self) -> None:
|
||||||
"""
|
"""
|
||||||
Moves the election channel into the archive category.
|
Marks the election as over.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.election_over = True
|
self.election_over = True
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
await election_channel.move(beginning=True, category=archive)
|
|
||||||
|
|
||||||
def get_election_info(self) -> ElectionInformation:
|
def get_election_info(self) -> ElectionInformation:
|
||||||
"""
|
"""
|
||||||
@@ -345,8 +325,6 @@ class ElectionCycle:
|
|||||||
)
|
)
|
||||||
|
|
||||||
message = f"Reminder to <@&{self.config.params.clan_member_role_id}>! Clan elections are happening! Head over "
|
message = f"Reminder to <@&{self.config.params.clan_member_role_id}>! Clan elections are happening! Head over "
|
||||||
message += (
|
message += f"to <#{self.get_election_info().ThreadId}> to cast your vote!"
|
||||||
f"to <#{self.get_election_info().ElectionChannel}> to cast your vote!"
|
|
||||||
)
|
|
||||||
|
|
||||||
await general.send(content=message)
|
await general.send(content=message)
|
||||||
|
|||||||
Reference in New Issue
Block a user