1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Changed tag command to allow the custom permissions set

This commit is contained in:
Phxntxm 2016-07-15 15:10:51 -05:00
parent 4eebf4ef2f
commit 10afdb7de0
2 changed files with 22 additions and 8 deletions

View file

@ -136,7 +136,7 @@ class Core:
config.closeConnection()
@tag.command(name='add', aliases=['create', 'start'], pass_context=True)
@commands.has_permissions(kick_members=True)
@checks.customPermsOrRole(kick_members=True)
async def add_tag(self, ctx, *result: str):
"""Use this to add a new tag that can be used in this server
Format to add a tag is !tag add <tag> - <result>"""

View file

@ -5,13 +5,27 @@ from . import config
def isOwner(ctx):
return ctx.message.author.id == config.ownerID
#def isOwner():
#def predicate(ctx):
#return ctx.message.author.id == config.ownerID
#return commands.check(predicate)
def customPermsOrRole(perm):
def predicate(ctx):
cursor = config.getCursor()
cursor.execute('use {}'.format(config.db_perms))
cmd = str(ctx.command)
sid = ctx.message.server.id
cursor.execute("show tables like '{}'".format(sid))
result = cursor.fetchone()
config.closeConnection()
if result is not None:
if perm is None:
return True
else:
for role in ctx.message.author.roles:
if getattr(role,perm):
return True:
return False
return True
return commands.check(predicate)
def isPM():
def predicate(ctx):
return ctx.message.channel.is_private