Turned on all ruff rules. Formatted all files.

This commit is contained in:
2024-05-22 15:06:39 -04:00
parent 3ac164ab65
commit 796b052bfc
18 changed files with 161 additions and 469 deletions
+7 -25
View File
@@ -21,9 +21,7 @@ from utils import VoteType, build_highcouncil_votes_str, get_election_name
class VoteSelect(nextcord.ui.StringSelect):
def __init__(
self, options: List["SelectOption"], config: DakinyConfig, election_type: str
) -> None:
def __init__(self, options: List["SelectOption"], config: DakinyConfig, election_type: str) -> None:
super().__init__(
placeholder="Choose 1",
min_values=1,
@@ -71,9 +69,7 @@ class VoteSelect(nextcord.ui.StringSelect):
session.commit()
vote_message_str = build_highcouncil_votes_str(self.config, interaction.guild)
vote_msg: nextcord.Message = await interaction.channel.fetch_message(
vote_msg_id
)
vote_msg: nextcord.Message = await interaction.channel.fetch_message(vote_msg_id)
await vote_msg.edit(content=vote_message_str)
if voted_for is not None:
@@ -99,9 +95,7 @@ class VoteHighcouncilView(nextcord.ui.View):
style=nextcord.ButtonStyle.primary,
custom_id="vote-cl",
)
async def vote_cl(
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
) -> None:
async def vote_cl(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None:
"""
Enforces only council elect vote. Gets election cycle, creates voting
options for clan leader (checking if user has voted already),
@@ -113,10 +107,7 @@ class VoteHighcouncilView(nextcord.ui.View):
"""
# enforce council elect only
if (
self.guild.get_role(self.config.params.clan_council_elect_role_id)
not in interaction.user.roles
):
if self.guild.get_role(self.config.params.clan_council_elect_role_id) not in interaction.user.roles:
await interaction.response.send_message(
f"You must have the <@&{self.config.params.clan_council_elect_role_id}> role to vote.",
ephemeral=True,
@@ -162,11 +153,7 @@ class VoteHighcouncilView(nextcord.ui.View):
)
view = nextcord.ui.View()
view.add_item(
VoteSelect(
options=options, config=self.config, election_type=VoteType.CLANLEADER
)
)
view.add_item(VoteSelect(options=options, config=self.config, election_type=VoteType.CLANLEADER))
await interaction.response.send_message(
content="Please vote for a Clan Leader!",
@@ -179,9 +166,7 @@ class VoteHighcouncilView(nextcord.ui.View):
style=nextcord.ButtonStyle.primary,
custom_id="vote-dm",
)
async def vote_dm(
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
) -> None:
async def vote_dm(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None:
"""
Enforces only council elect vote. Gets election cycle, creates voting
options for discord manager (checking if user has voted already),
@@ -193,10 +178,7 @@ class VoteHighcouncilView(nextcord.ui.View):
"""
# enforce council elect only
if (
self.guild.get_role(self.config.params.clan_council_elect_role_id)
not in interaction.user.roles
):
if self.guild.get_role(self.config.params.clan_council_elect_role_id) not in interaction.user.roles:
await interaction.response.send_message(
f"You must have the <@&{self.config.params.clan_council_elect_role_id}> role to vote.",
ephemeral=True,