From 45f93367a43425c4fa4db96fef6513343cc7280c Mon Sep 17 00:00:00 2001 From: flifloo Date: Thu, 5 Nov 2020 15:03:17 +0100 Subject: [PATCH] Add support of disabled extension for utils --- extensions/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extensions/utils.py b/extensions/utils.py index 1a6365b..cfde40d 100644 --- a/extensions/utils.py +++ b/extensions/utils.py @@ -4,6 +4,7 @@ from discord import Embed, Member, Guild from discord.ext import commands from discord.ext.commands import BadArgument +from administrator.check import is_enabled from administrator.logger import logger @@ -19,6 +20,7 @@ class Utils(commands.Cog): return "Some tools" @commands.group("utils", pass_context=True) + @is_enabled() async def utils(self, ctx: commands.Context): if ctx.invoked_subcommand is None: await ctx.invoke(self.utils_help) @@ -50,12 +52,14 @@ class Utils(commands.Cog): await ctx.send(f"```{e.__class__.__name__}: {e}```") @commands.group("ping", pass_context=True) + @is_enabled() async def ping(self, ctx: commands.Context): start = datetime.now() msg = await ctx.send(f"Discord WebSocket latency: `{round(self.bot.latency*1000)}ms`") await msg.edit(content=msg.content+"\n"+f"Bot latency: `{round((msg.created_at - start).microseconds/1000)}ms`") @commands.group("info", pass_context=True) + @is_enabled() async def info(self, ctx: commands.Context): if len(ctx.message.mentions) > 1: raise BadArgument()