Address ruff smells in create.py.

This commit is contained in:
2025-02-17 15:03:07 -05:00
parent 136702654e
commit a12fca6220
+16 -22
View File
@@ -1,6 +1,4 @@
"""
Commands for creating items in bot.
"""
"""Commands for creating items in bot."""
import nextcord
from nextcord.ext import commands
@@ -14,35 +12,29 @@ from utilities.utils import MAX_LINE_LENGTH, autofill_groups, send_highscore_mes
class CreateCog(commands.Cog, name="Create Cog"):
"""
Class holds commands for creating things.
"""
"""Class holds commands for creating things."""
def __init__(self, bot: commands.Bot) -> None:
"""
Default constructor for CreateCog class.
"""
"""Default constructor for CreateCog class."""
self._bot = bot
@nextcord.slash_command(default_member_permissions=nextcord.Permissions(administrator=True))
async def create(self, interaction: nextcord.Interaction):
"""
Parent slash command for creating things. Never called.
"""
async def create(self, interaction: nextcord.Interaction) -> None:
"""Parent slash command for creating things. Never called."""
# need all these arguments because discord command.
# pylint: disable=too-many-arguments
@create.subcommand(description="Create a new Category. Must not exist already in Group.")
async def category(
async def category( # noqa: PLR0913
self,
interaction: nextcord.Interaction,
group_id: str = nextcord.SlashOption(name="group", description="Group to add Category to.", required=True),
category_name: str = nextcord.SlashOption(description="Name of new Category.", required=True),
is_ascending: bool = nextcord.SlashOption(description="If lower value is a better score.", required=True),
is_time_record: bool = nextcord.SlashOption(
is_ascending: bool = nextcord.SlashOption(description="If lower value is a better score.", required=True), # noqa: FBT001
is_time_record: bool = nextcord.SlashOption( # noqa: FBT001
description="If the score should be shown in time format. Cannot be changed.", required=True
),
is_validated: bool = nextcord.SlashOption(
is_validated: bool = nextcord.SlashOption( # noqa: FBT001
description="If scores need to be validated before posted.", required=True
),
size: int = nextcord.SlashOption(
@@ -50,8 +42,9 @@ class CreateCog(commands.Cog, name="Create Cog"):
),
) -> None:
"""
Creates a new category to be placed into group_id group. Fails if the category name already exists within the
group. Then calls send_highscore_message().
Creates a new category to be placed into group_id group.
Fails if the category name already exists within the group. Then calls send_highscore_message().
Args:
interaction (nextcord.Interaction): Interaction for the command.
@@ -118,8 +111,9 @@ class CreateCog(commands.Cog, name="Create Cog"):
),
) -> None:
"""
Creates a new category group to be placed into the database with the guild's id. Fails if the category group
name already exists within the guild. Then calls send_highscore_message().
Creates a new category group to be placed into the database with the guild's id.
Fails if the category group name already exists within the guild. Then calls send_highscore_message().
Args:
interaction (nextcord.Interaction): Interaction for the command.
@@ -156,7 +150,7 @@ class CreateCog(commands.Cog, name="Create Cog"):
)
@category.on_autocomplete("group_id")
async def group_autocomplete(self, interaction: nextcord.Interaction, group_id: str):
async def group_autocomplete(self, interaction: nextcord.Interaction, group_id: str) -> None:
"""
Collects list of table names and compares to input table name for autocomplete assistance.