Changed tag command to allow the custom permissions set
This commit is contained in:
parent
4eebf4ef2f
commit
10afdb7de0
|
@ -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>"""
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue