Renamed python files to more describe their contents. Intend on having more than 1 class per file.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
"""
|
||||
Commands for managing the tables/categories/scores for a Guild.
|
||||
"""
|
||||
|
||||
from nextcord.ext import commands
|
||||
import nextcord
|
||||
|
||||
from highscores import highscores_data # pylint: disable=import-error
|
||||
|
||||
|
||||
class DeleteScores(commands.Cog, name="Delete Scores"):
|
||||
"""
|
||||
Warning: This command only works for developers.
|
||||
Deletes this guild's scores.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
Default constructor for DeleteScores class. Does nothing.
|
||||
"""
|
||||
|
||||
@nextcord.slash_command(
|
||||
description="Deletes all scores for this guild. Used for testing.",
|
||||
default_member_permissions=nextcord.Permissions(administrator=True),
|
||||
)
|
||||
async def delete_scores(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
A command which deletes all scores in all tables for this guild.
|
||||
Command limits to admins to prevent devs from usings on non-test servers.
|
||||
"""
|
||||
# only allow AlwaysCompiling to use.
|
||||
# If you are a developer and want to use command, can add name to list
|
||||
if interaction.user.id == 206602713511886849:
|
||||
for table in highscores_data.get_guild(interaction.guild_id).tables:
|
||||
for category in table.categories:
|
||||
category.clear()
|
||||
highscores_data.save_guild_data(highscores_data.get_guild(interaction.guild_id))
|
||||
await interaction.response.send_message(
|
||||
f"Cleared score data for {interaction.guild.name}.", ephemeral=True
|
||||
)
|
||||
else:
|
||||
await interaction.response.send_message(
|
||||
"You shouldn't be using this message.", ephemeral=True
|
||||
)
|
||||
Reference in New Issue
Block a user