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
+11 -39
View File
@@ -74,14 +74,8 @@ class NominateDMModal(nextcord.ui.Modal):
council_elect.DiscordManagerSpeechId = msg.id
session.commit()
else:
msg: nextcord.Message = await interaction.channel.fetch_message(
council_elect.DiscordManagerSpeechId
)
await msg.edit(
content=decorate_dm_nomination(
interaction.user.id, self.speech.value
)
)
msg: nextcord.Message = await interaction.channel.fetch_message(council_elect.DiscordManagerSpeechId)
await msg.edit(content=decorate_dm_nomination(interaction.user.id, self.speech.value))
class NominateCLModal(nextcord.ui.Modal):
@@ -141,14 +135,8 @@ class NominateCLModal(nextcord.ui.Modal):
council_elect.ClanLeaderSpeechId = msg.id
session.commit()
else:
msg: nextcord.Message = await interaction.channel.fetch_message(
council_elect.ClanLeaderSpeechId
)
await msg.edit(
content=decorate_cl_nomination(
interaction.user.id, self.speech.value
)
)
msg: nextcord.Message = await interaction.channel.fetch_message(council_elect.ClanLeaderSpeechId)
await msg.edit(content=decorate_cl_nomination(interaction.user.id, self.speech.value))
class NominateHighCouncilView(nextcord.ui.View):
@@ -166,9 +154,7 @@ class NominateHighCouncilView(nextcord.ui.View):
style=nextcord.ButtonStyle.primary,
custom_id="nominate-dm",
)
async def nominate_dm(
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
) -> None:
async def nominate_dm(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None:
"""
Gathers previous information about the user if they have already nominated themselves, then launches
the nomination modal to get their speech.
@@ -179,10 +165,7 @@ class NominateHighCouncilView(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,
@@ -203,15 +186,11 @@ class NominateHighCouncilView(nextcord.ui.View):
# user needs to exist to get here anyways...
if obj.DiscordManagerSpeechId is not None:
usr_nominated = True
msg = await interaction.channel.fetch_message(
obj.DiscordManagerSpeechId
)
msg = await interaction.channel.fetch_message(obj.DiscordManagerSpeechId)
speech_content = msg.content.split(NOMINEE_SPLITTER)[1]
await interaction.response.send_modal(
NominateDMModal(
self.config, interaction.user.id, usr_nominated, speech_content
)
NominateDMModal(self.config, interaction.user.id, usr_nominated, speech_content)
)
@nextcord.ui.button(
@@ -219,9 +198,7 @@ class NominateHighCouncilView(nextcord.ui.View):
style=nextcord.ButtonStyle.primary,
custom_id="nominate-cl",
)
async def nominate_cl(
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
) -> None:
async def nominate_cl(self, button: nextcord.ui.Button, interaction: nextcord.Interaction) -> None:
"""
Gathers previous information about the user if they have already nominated themselves, then launches
the nomination modal to get their speech.
@@ -232,10 +209,7 @@ class NominateHighCouncilView(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,
@@ -260,7 +234,5 @@ class NominateHighCouncilView(nextcord.ui.View):
speech_content = msg.content.split(NOMINEE_SPLITTER)[1]
await interaction.response.send_modal(
NominateCLModal(
self.config, interaction.user.id, usr_nominated, speech_content
)
NominateCLModal(self.config, interaction.user.id, usr_nominated, speech_content)
)