41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
"""
|
|
Bot command for deleting the guild's scores.
|
|
"""
|
|
|
|
from nextcord import Embed
|
|
from nextcord.ext import commands
|
|
|
|
from highscores import highscores_data # pylint: disable=import-error
|
|
from utilities.highscores_data import save_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, bot: commands.Bot):
|
|
self.bot = bot
|
|
|
|
@commands.command(name="delete-scores")
|
|
@commands.has_permissions(administrator=True)
|
|
async def delete_scores(self, ctx: commands.Context):
|
|
"""A command which deletes all scores for this guild.
|
|
Usage:
|
|
```
|
|
?delete_scores
|
|
```
|
|
"""
|
|
# only allow AlwaysCompiling to use.
|
|
# If you are a developer and want to use command, can add name to list
|
|
if ctx.author.id == 206602713511886849:
|
|
highscores_data.reset_guild_data(ctx.guild.id)
|
|
|
|
|
|
# This function will be called when this extension is loaded.
|
|
# It is necessary to add these functions to the bot.
|
|
def setup(bot: commands.Bot):
|
|
"""Adds function to bot"""
|
|
bot.add_cog(DeleteScores(bot))
|