Fix some code smells in set.py.

This commit is contained in:
2025-02-20 17:38:03 -05:00
parent 385129c434
commit fb31e12bc0
+8 -15
View File
@@ -1,6 +1,4 @@
""" """Set command hierarchy."""
Set command heirarchy.
"""
import nextcord import nextcord
from nextcord.ext import commands from nextcord.ext import commands
@@ -13,20 +11,14 @@ from utilities.utils import MAX_LINE_LENGTH, autofill_groups
class SetCog(commands.Cog, name="Set command."): class SetCog(commands.Cog, name="Set command."):
""" """Class holds commands for setting variables in guild's database."""
Class holds commands for setting variables in guild's database.
"""
def __init__(self) -> None: def __init__(self) -> None:
""" """Default constructor for SetCog class. Does nothing."""
Default constructor for SetCog class. Does nothing.
"""
@nextcord.slash_command(default_member_permissions=nextcord.Permissions(administrator=True)) @nextcord.slash_command(default_member_permissions=nextcord.Permissions(administrator=True))
async def set(self, interaction: nextcord.Interaction): async def set(self, interaction: nextcord.Interaction) -> None:
""" """Parent slash command for setting settings. Never called."""
Parent slash command for setting settings. Never called.
"""
@set.subcommand(description="Registers the channel for a Category Group's messages.") @set.subcommand(description="Registers the channel for a Category Group's messages.")
async def group_output_channel( async def group_output_channel(
@@ -121,7 +113,7 @@ class SetCog(commands.Cog, name="Set command."):
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command interaction (nextcord.Interaction): Interaction that invoked the command
channel Optional[nextcord.abc.GuildChannel], optional): Channel to register channel (nextcord.abc.GuildChannel, optional): Channel to register.
Is a SlashOption. Limited to text channels, Defaults to None. Is a SlashOption. Limited to text channels, Defaults to None.
""" """
if not channel: if not channel:
@@ -151,6 +143,7 @@ class SetCog(commands.Cog, name="Set command."):
Args: Args:
interaction (nextcord.Interaction): Interaction that invoked the command interaction (nextcord.Interaction): Interaction that invoked the command
group_id (str): The group to change the username length of.
length (int): Number of characters. Is SlashOption. Defaults to 12. length (int): Number of characters. Is SlashOption. Defaults to 12.
""" """
with Session(engine) as session: with Session(engine) as session:
@@ -196,7 +189,7 @@ class SetCog(commands.Cog, name="Set command."):
@group_output_channel.on_autocomplete("group_id") @group_output_channel.on_autocomplete("group_id")
@pad_length.on_autocomplete("group_id") @pad_length.on_autocomplete("group_id")
@username_length.on_autocomplete("group_id") @username_length.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:
""" """
Sends results from autofill_groups back to group_output_channel for autocompletion of group_id. Sends results from autofill_groups back to group_output_channel for autocompletion of group_id.