Add support of disabled extension for reminder
This commit is contained in:
parent
234e8e1877
commit
b24aebc906
2 changed files with 3 additions and 1 deletions
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
Reference in a new issue