diff --git a/extensions/reminder.py b/extensions/reminder.py index b687dd7..528f579 100644 --- a/extensions/reminder.py +++ b/extensions/reminder.py @@ -4,10 +4,12 @@ from discord.ext import commands from discord import Embed from discord.ext.commands import BadArgument from discord.ext import tasks +from discord_slash import SlashContext, cog_ext, SlashCommandOptionType +from discord_slash.utils import manage_commands from administrator.check import is_enabled from administrator.logger import logger -from administrator import db +from administrator import db, slash from administrator.utils import time_pars, seconds_to_time_string extension_name = "reminders" @@ -17,61 +19,52 @@ logger = logger.getChild(extension_name) class Reminders(commands.Cog, name="Reminder"): def __init__(self, bot: commands.Bot): self.bot = bot + slash.get_cog_commands(self) def description(self): return "Create and manage reminders" - @commands.group("reminder", pass_context=True) + @cog_ext.cog_subcommand(base="reminder", name="add", description="Add a reminder to your reminders list", options=[ + manage_commands.create_option("message", "The message", SlashCommandOptionType.STRING, True), + manage_commands.create_option("time", "When, ?D?H?M?S", SlashCommandOptionType.STRING, True) + ]) @is_enabled() - async def reminder(self, ctx: commands.Context): - if ctx.invoked_subcommand is None: - await ctx.invoke(self.reminder_help) - - @reminder.group("help", pass_context=True) - async def reminder_help(self, ctx: commands.Context): - embed = Embed(title="Reminder help") - embed.add_field(name="reminder add