diff --git a/src/bot.py b/src/bot.py index c9b34a5..523a1b0 100644 --- a/src/bot.py +++ b/src/bot.py @@ -8,7 +8,14 @@ import discord from discord import app_commands -from src.commands.stats import SubscribedMessage, stats, stats_subscribe, load_subscribed_messages, SUBSCRIBE_MSG_FILE +from src.commands.stats import ( + SubscribedMessage, + stats_subscribe, + load_subscribed_messages, + SUBSCRIBE_MSG_FILE, + Stats, + post_stats, +) from src.constants import ( SPECIAL_ROLE, VERIFIED_ROLE, @@ -57,8 +64,10 @@ def __init__( team.add_command(create_voice) team.add_command(create_team_channel) self.tree.add_command(team, guild=self.guild) + stats = Stats() + stats.add_command(post_stats) + stats.add_command(stats_subscribe) self.tree.add_command(stats, guild=self.guild) - self.tree.add_command(stats_subscribe, guild=self.guild) self.tree.add_command(join, guild=self.guild) load_subscribed_messages(self) diff --git a/src/commands/stats.py b/src/commands/stats.py index f860266..979c962 100644 --- a/src/commands/stats.py +++ b/src/commands/stats.py @@ -44,14 +44,20 @@ def __eq__(self, comp: object) -> bool: ) -@app_commands.command() +@app_commands.guild_only() +@app_commands.default_permissions() +class Stats(app_commands.Group): + pass + + +@app_commands.command(name='post') @app_commands.describe( members='Display the number of members in each team', warnings='Display warnings about missing supervisors and empty teams', stats='Display statistics about the teams', ) @app_commands.checks.has_role(VOLUNTEER_ROLE) -async def stats( +async def post_stats( ctx: discord.interactions.Interaction["BotClient"], members: bool = False, warnings: bool = False, @@ -66,7 +72,7 @@ async def stats( await send_response(ctx, message) -@discord.app_commands.command() # type:ignore[arg-type] +@discord.app_commands.command(name='subscribe') # type:ignore[arg-type] @app_commands.describe( members='Display the number of members in each team', warnings='Display warnings about missing supervisors and empty teams',