From 96d432988ab8208737b1c722938296ffae78ee1e Mon Sep 17 00:00:00 2001 From: stolenvw Date: Fri, 16 Apr 2021 18:51:54 -0400 Subject: Added channel check to setstatus and savestats commands --- code/botcmds/maincmd.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/botcmds/maincmd.py b/code/botcmds/maincmd.py index 28a36f2..53088eb 100644 --- a/code/botcmds/maincmd.py +++ b/code/botcmds/maincmd.py @@ -276,6 +276,7 @@ class Main(commands.Cog): usage=' <"arg1">', ) @commands.has_any_role(config.SETSTATUS_CMD) + @commands.check(chancheck) async def setstatus(self, ctx, arg: typing.Optional[str] = '0', arg1: typing.Optional[str] = '1'): if arg == "playing": await self.bot.change_presence(activity=discord.Game(arg1)) @@ -295,12 +296,18 @@ class Main(commands.Cog): bugchan = self.bot.get_channel(config.BUGCHANNEL_ID) bugerror = discord.Embed(title=":sos: **ERROR** :sos:", description='**{}** Tried to use command: **{}**\n{}'.format(ctx.author, ctx.command, error), color=0xFF001E) await bugchan.send(embed=bugerror) + if isinstance(error, commands.CheckFailure): + if config.USEDEBUGCHAN == True: + bugchan = self.bot.get_channel(config.BUGCHANNEL_ID) + bugerror = discord.Embed(title=":sos: **ERROR** :sos:", description='**{}** Tried to use command: **{}**\nIn channel **#{}**'.format(ctx.author, ctx.command, ctx.channel), color=0xFF001E) + await bugchan.send(embed=bugerror) @commands.command(name="savestats", brief="Save stats", help="Shows how many zods where saved and time it took to save them.", ) @commands.has_any_role(config.SAVESTATS_CMD) + @commands.check(chancheck) async def savestats(self, ctx): if config.EXSERVERINFO == True: botsql = self.bot.get_cog('BotSQL') @@ -337,6 +344,11 @@ class Main(commands.Cog): bugchan = self.bot.get_channel(config.BUGCHANNEL_ID) bugerror = discord.Embed(title=":sos: **ERROR** :sos:", description='**{}** Tried to use command: **{}**\n{}'.format(ctx.author, ctx.command, error), color=0xFF001E) await bugchan.send(embed=bugerror) + if isinstance(error, commands.CheckFailure): + if config.USEDEBUGCHAN == True: + bugchan = self.bot.get_channel(config.BUGCHANNEL_ID) + bugerror = discord.Embed(title=":sos: **ERROR** :sos:", description='**{}** Tried to use command: **{}**\nIn channel **#{}**'.format(ctx.author, ctx.command, ctx.channel), color=0xFF001E) + await bugchan.send(embed=bugerror) def setup(bot): bot.add_cog(Main(bot)) -- cgit v1.2.3