diff options
author | stolenvw <stolenvw@hotmail.com> | 2021-04-16 18:51:54 -0400 |
---|---|---|
committer | stolenvw <stolenvw@hotmail.com> | 2021-04-16 18:51:54 -0400 |
commit | 96d432988ab8208737b1c722938296ffae78ee1e (patch) | |
tree | eda2c40d10c6a0070a669ba781adc6b92bc79817 | |
parent | a14b6c09fb0551a26b6254dda617985d61ef5f87 (diff) |
Added channel check to setstatus and savestats commands
-rw-r--r-- | code/botcmds/maincmd.py | 12 |
1 files changed, 12 insertions, 0 deletions
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='<arg> <"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)) |