From b24aebc906a734506766f64ad08f06938ffe2870 Mon Sep 17 00:00:00 2001 From: flifloo Date: Thu, 5 Nov 2020 14:56:18 +0100 Subject: [PATCH] Add support of disabled extension for reminder --- administrator/check.py | 2 +- extensions/reminder.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/administrator/check.py b/administrator/check.py index 3e36548..3d1cb6a 100644 --- a/administrator/check.py +++ b/administrator/check.py @@ -9,7 +9,7 @@ class ExtensionDisabled(commands.CheckFailure): def is_enabled(): async def check(ctx: commands.Context): - if ctx.command.cog: + if ctx.command.cog and ctx.guild: s = db.Session() es = s.query(db.ExtensionState).get((ctx.command.cog.qualified_name, ctx.guild.id)) s.close() diff --git a/extensions/reminder.py b/extensions/reminder.py index 1003f30..bfea5cc 100644 --- a/extensions/reminder.py +++ b/extensions/reminder.py @@ -6,6 +6,7 @@ from discord import Embed from discord.ext.commands import BadArgument from discord.ext import tasks +from administrator.check import is_enabled from administrator.logger import logger from administrator import db from administrator.utils import time_pars, seconds_to_time_string @@ -22,6 +23,7 @@ class Reminders(commands.Cog, name="Reminder"): return "Create and manage reminders" @commands.group("reminder", pass_context=True) + @is_enabled() async def reminder(self, ctx: commands.Context): if ctx.invoked_subcommand is None: await ctx.invoke(self.reminder_help)