summaryrefslogtreecommitdiff
path: root/code/botcmds/helpcmds.py
diff options
context:
space:
mode:
authorstolenvw <stolenvw@hotmail.com>2021-04-15 18:54:05 -0400
committerstolenvw <stolenvw@hotmail.com>2021-04-15 18:54:05 -0400
commitc5e6a213d5eda8b2122b8858ed53dc55a5537c9c (patch)
tree9ea74712c87217505dfde8bab0399ace34291ee1 /code/botcmds/helpcmds.py
parent68e8f975c2cade235a0f2bdb2edfb20a467fc2b6 (diff)
Added role check for commands, so you can set what roles users need to use a command.
Set commands to only work in the LOGCHAN_ID channel if not owner. Owner can use commands in any channel.
Diffstat (limited to 'code/botcmds/helpcmds.py')
-rw-r--r--code/botcmds/helpcmds.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/code/botcmds/helpcmds.py b/code/botcmds/helpcmds.py
index ea5572e..aa32dcb 100644
--- a/code/botcmds/helpcmds.py
+++ b/code/botcmds/helpcmds.py
@@ -41,14 +41,19 @@ class Help(commands.Cog):
self.bot = bot
self.bot.remove_command("help")
+ async def chancheck(ctx):
+ if ctx.channel.id == config.LOGCHAN_ID or commands.is_owner():
+ return True
+
@commands.command()
+ @commands.check(chancheck)
# @commands.bot_has_permissions(add_reactions=True,embed_links=True)
async def help(self, ctx, *input):
"""Shows all modules of that bot"""
# !SET THOSE VARIABLES TO MAKE THE COG FUNCTIONAL!
prefix = config.BOT_PREFIX
- version = "v0.2.0"
+ version = "v0.2.1"
# checks if cog parameter was given
# if not: sending all modules and commands not associated with a cog
@@ -142,6 +147,19 @@ class Help(commands.Cog):
# sending reply embed using our own function defined above
await send_embed(ctx, emb)
+ @help.error
+ async def help_error_handler(self, ctx, error):
+ if isinstance(error, commands.MissingAnyRole):
+ if config.USEDEBUGCHAN == True:
+ 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(Help(bot))