Remove all references to table. Remove a dead function. Fix some code smells.

This commit is contained in:
2025-02-20 17:23:57 -05:00
parent 36dad683d8
commit 327126307d
7 changed files with 29 additions and 65 deletions
+13 -20
View File
@@ -14,13 +14,11 @@ from utilities.utils import autofill_groups, send_highscore_message
class RefreshCog(commands.Cog, name="Refresh Cog"):
"""
Class holds commands for refreshing.
"""
"""Class holds commands for refreshing."""
def __init__(self, bot: commands.Bot) -> None:
"""
Default constructor for RefreshCog class
Default constructor for RefreshCog class.
Args:
bot (commands.Bot): Bot object. Required to register submission button view.
@@ -28,19 +26,17 @@ class RefreshCog(commands.Cog, name="Refresh Cog"):
self._bot = bot
@nextcord.slash_command(default_member_permissions=nextcord.Permissions(administrator=True))
async def refresh(self, interaction: nextcord.Interaction):
"""
Parent slash command for refreshing things. Never called.
"""
async def refresh(self, interaction: nextcord.Interaction) -> None:
"""Parent slash command for refreshing things. Never called."""
@refresh.subcommand(description="Manually refresh a table. Use when changing settings or data manually changed.")
@refresh.subcommand(description="Manually refresh a group. Use when changing settings or data manually changed.")
async def group(
self,
interaction: nextcord.Interaction,
group_id: str = nextcord.SlashOption(name="group", description="Name of Group.", required=True),
) -> None:
"""
Refreshes a table given by user.
Refreshes a group given by user.
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
@@ -57,22 +53,19 @@ class RefreshCog(commands.Cog, name="Refresh Cog"):
message: nextcord.Message = await send_highscore_message(session, interaction.guild, group)
await message.edit(view=SubmissionCreateButton(self._bot))
await interaction.response.send_message(f"Updated table {group.GroupName}!", ephemeral=True)
await interaction.response.send_message(f"Updated group {group.GroupName}!", ephemeral=True)
@refresh.subcommand()
async def all(self, interaction: nextcord.Interaction):
"""
Subcommand parent for refreshing all things. Never called.
"""
async def all(self, interaction: nextcord.Interaction) -> None:
"""Subcommand parent for refreshing all things. Never called."""
@all.subcommand(description="Triggers post/update of highscores to registered highscore channels.")
async def groups(self, interaction: nextcord.Interaction) -> None:
"""
A command which posts the highscore in the registered channel.
Sends warning if no channel has been registered.
Either creates new messages for each table if one doesn't exist
or edits the existing message.
Sends warning if no channel has been registered. Either creates new messages for each group if one doesn't
exist or edits the existing message.
Args:
interaction (nextcord.Interaction): Interaction that invoked the command.
@@ -90,9 +83,9 @@ class RefreshCog(commands.Cog, name="Refresh Cog"):
await interaction.send(f"Posted all groups in {interaction.guild.name}'s highscores.", ephemeral=True)
@group.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.
Collects list of group names and compares to input group name for autocomplete assistance.
Args:
interaction (nextcord.Interaction): Interaction with command.