From 6c32dcbead8be2cfc851a7250435473040cafacd Mon Sep 17 00:00:00 2001 From: Abigail Date: Tue, 28 Jan 2020 22:45:10 -0500 Subject: [PATCH] fix can_run logic, re-hide xd, remove unnecessary checks --- exts/base.py | 10 ++++++---- exts/fun.py | 2 +- main.py | 4 ---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/exts/base.py b/exts/base.py index 6f36582..15b20b2 100644 --- a/exts/base.py +++ b/exts/base.py @@ -76,9 +76,12 @@ class QrmHelpCommand(commands.HelpCommand): await self.context.send(embed=embed) async def send_command_help(self, command): - if self.verify_checks and not await command.can_run(self.context): - raise commands.CheckFailure - return + if self.verify_checks: + if not await command.can_run(self.context): + raise commands.CheckFailure + for p in command.parents: + if not await p.can_run(self.context): + raise commands.CheckFailure embed = cmn.embed_factory(self.context) embed.title = await self.get_command_signature(command) embed.description = command.help @@ -87,7 +90,6 @@ class QrmHelpCommand(commands.HelpCommand): async def send_group_help(self, group): if self.verify_checks and not await group.can_run(self.context): raise commands.CheckFailure - return embed = cmn.embed_factory(self.context) embed.title = await self.get_command_signature(group) embed.description = group.help diff --git a/exts/fun.py b/exts/fun.py index 6fcbae5..d84f513 100644 --- a/exts/fun.py +++ b/exts/fun.py @@ -30,7 +30,7 @@ class FunCog(commands.Cog): '''Returns an xkcd about tar.''' await ctx.send('http://xkcd.com/1168') - @commands.command(name="xd", category=cmn.cat.fun) + @commands.command(name="xd", hidden=True, category=cmn.cat.fun) async def _xd(self, ctx: commands.Context): '''ecks dee''' await ctx.send('ECKS DEE :smirk:') diff --git a/main.py b/main.py index 3cb103d..4fb577b 100644 --- a/main.py +++ b/main.py @@ -93,7 +93,6 @@ async def _extctl(ctx: commands.Context): @_extctl.command(name="list", aliases=["ls"]) -@commands.check(cmn.check_if_owner) async def _extctl_list(ctx: commands.Context): """Lists Extensions.""" embed = cmn.embed_factory(ctx) @@ -103,7 +102,6 @@ async def _extctl_list(ctx: commands.Context): @_extctl.command(name="load", aliases=["ld"]) -@commands.check(cmn.check_if_owner) async def _extctl_load(ctx: commands.Context, extension: str): try: bot.load_extension(ext_dir + "." + extension) @@ -114,7 +112,6 @@ async def _extctl_load(ctx: commands.Context, extension: str): @_extctl.command(name="reload", aliases=["rl", "r", "relaod"]) -@commands.check(cmn.check_if_owner) async def _extctl_reload(ctx: commands.Context, extension: str): if ctx.invoked_with == "relaod": pika = bot.get_emoji(opt.pika) @@ -129,7 +126,6 @@ async def _extctl_reload(ctx: commands.Context, extension: str): @_extctl.command(name="unload", aliases=["ul"]) -@commands.check(cmn.check_if_owner) async def _extctl_unload(ctx: commands.Context, extension: str): try: bot.unload_extension(ext_dir + "." + extension)