Remove all references to table. Remove a dead function. Fix some code smells.
This commit is contained in:
+10
-10
@@ -18,7 +18,7 @@ from utilities.utils import (
|
||||
from .views.delete_confirm import DeleteConfirmView, create_delete_id
|
||||
|
||||
|
||||
class DeleteCog(commands.Cog, name="Table Management"):
|
||||
class DeleteCog(commands.Cog, name="Delete Cog"):
|
||||
"""Class holds commands for deleting."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
@@ -32,7 +32,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
async def all(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Subcommand parent for deleting all of a thing. Never called."""
|
||||
|
||||
@all.subcommand(description="Clears highscores channel of all table messages. Does not change data.")
|
||||
@all.subcommand(description="Clears highscores channel of all highscore messages. Does not change data.")
|
||||
async def channel_messages(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
@@ -69,16 +69,16 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
|
||||
for group in groups:
|
||||
try:
|
||||
table_message: nextcord.Message = await channel.fetch_message(group.MessageId)
|
||||
await table_message.delete()
|
||||
message: nextcord.Message = await channel.fetch_message(group.MessageId)
|
||||
await message.delete()
|
||||
except nextcord.NotFound:
|
||||
# silently ignore that messages are not found. They got deleted already.
|
||||
pass
|
||||
|
||||
await interaction.send("Table messages deleted.", ephemeral=True)
|
||||
await interaction.send("Highscore messages deleted.", ephemeral=True)
|
||||
|
||||
@all.subcommand(
|
||||
description="Removes all of a user's scores. Warning: data is destroyed, use with case.",
|
||||
description="Removes all of a user's scores. Warning: data is destroyed, use with care.",
|
||||
)
|
||||
async def users(
|
||||
self,
|
||||
@@ -90,7 +90,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
"""
|
||||
Searches all of guild's scores data for any score from the user and removes.
|
||||
|
||||
Updates table message is user was removed from that table.
|
||||
Updates highscore message if user was removed from that Category Group.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
@@ -112,7 +112,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
for group in session.scalars(stmt):
|
||||
await send_highscore_message(session, interaction.guild, group)
|
||||
|
||||
await interaction.send(f'User "{user_name}" was removed from all tables.', ephemeral=True)
|
||||
await interaction.send(f'User "{user_name}" was removed from all Category Groups.', ephemeral=True)
|
||||
|
||||
@delete.subcommand(description="Delete a category from a group. Deletion is perminant.")
|
||||
async def category(
|
||||
@@ -225,7 +225,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
@group.on_autocomplete("group_id")
|
||||
async def group_autocomplete(self, interaction: nextcord.Interaction, group_id: str) -> None:
|
||||
"""
|
||||
Autocomplete function for table names.
|
||||
Autocomplete function for group names.
|
||||
|
||||
Args:
|
||||
interaction (nextcord.Interaction): Interaction that invoked the command.
|
||||
@@ -264,7 +264,7 @@ class DeleteCog(commands.Cog, name="Table Management"):
|
||||
"""
|
||||
await interaction.response.send_autocomplete(
|
||||
autofill_users_in_group_category(
|
||||
interaction.guild_id, int(group_id), category_id if category_id else 0, user_name
|
||||
interaction.guild_id, int(group_id), int(category_id) if category_id else 0, user_name
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user