Added some confirmations when perms command is ran
This commit is contained in:
parent
308ad3cb21
commit
ae56fc0528
11
cogs/mod.py
11
cogs/mod.py
|
@ -68,7 +68,10 @@ class Mod:
|
|||
await self.bot.delete_message(ctx.message)
|
||||
|
||||
@commands.group(pass_context=True, invoke_without_command=True)
|
||||
async def perms(self, ctx, command: str):
|
||||
async def perms(self, ctx, command: str = ""):
|
||||
if command == "":
|
||||
await self.bot.say("Valid permissions are: ```{}```".format("\n".join("{}".format(i) for i in valid_perms)))
|
||||
return
|
||||
if command not in self.bot.commands:
|
||||
await self.bot.say("{} does not appear to be a valid command!".format(command))
|
||||
return
|
||||
|
@ -92,9 +95,6 @@ class Mod:
|
|||
@perms.command(name="add", aliases=["setup,create"], pass_context=True)
|
||||
@commands.has_permissions(manage_server=True)
|
||||
async def add_perms(self, ctx, command: str, permissions: str):
|
||||
try:
|
||||
#await self.bot.say("Command is: `{}`\nPermissions is: `{}`\n Type of command is `{}`\n Type of permissions is `{}`".format(command,permissions,type(command),type(permissions)))
|
||||
#return
|
||||
for checks in self.bot.commands.get(command).checks:
|
||||
if "isOwner" == checks.__name__:
|
||||
await self.bot.say("This command cannot have custom permissions setup!")
|
||||
|
@ -124,9 +124,8 @@ class Mod:
|
|||
sql = "update `"+ctx.message.server.id+"` set perms=%s where command=%s"
|
||||
cursor.execute(sql,(perms,command))
|
||||
|
||||
await self.bot.say("I have just added your custom permissions; you now need to have {} permissions to use the command {}".format(permissions, command))
|
||||
config.closeConnection()
|
||||
except:
|
||||
traceback.print_exc(file=open("/home/phxntx5/public_html/Bonfire/bot_error","a"))
|
||||
|
||||
|
||||
def setup(bot):
|
||||
|
|
Loading…
Reference in a new issue