2016-07-09 13:27:19 +12:00
|
|
|
from discord.ext import commands
|
|
|
|
from . import config
|
|
|
|
|
|
|
|
|
2016-07-16 01:28:23 +12:00
|
|
|
def isOwner(ctx):
|
2016-07-16 01:26:32 +12:00
|
|
|
return ctx.message.author.id == config.ownerID
|
2016-07-09 13:27:19 +12:00
|
|
|
|
2016-07-16 09:39:26 +12:00
|
|
|
|
2016-07-16 08:10:51 +12:00
|
|
|
def customPermsOrRole(perm):
|
|
|
|
def predicate(ctx):
|
2016-07-16 11:34:10 +12:00
|
|
|
if ctx.message.channel.is_private:
|
|
|
|
return False
|
2016-07-18 05:45:24 +12:00
|
|
|
custom_permissions = config.getContent('custom_permissions')
|
2016-07-18 08:58:13 +12:00
|
|
|
_perm = None
|
2016-07-18 05:45:24 +12:00
|
|
|
try:
|
2016-07-18 08:23:38 +12:00
|
|
|
_perm = custom_permissions[ctx.message.server.id][str(ctx.command)]
|
2016-07-18 05:45:24 +12:00
|
|
|
except KeyError:
|
|
|
|
pass
|
2016-07-18 08:23:38 +12:00
|
|
|
|
|
|
|
if _perm is None:
|
2016-07-18 08:54:31 +12:00
|
|
|
return getattr(ctx.message.author.permissions_in(ctx.message.channel), perm)
|
2016-07-18 08:23:38 +12:00
|
|
|
else:
|
2016-07-18 08:54:31 +12:00
|
|
|
return getattr(ctx.message.author.permissions_in(ctx.message.channel), _perm)
|
2016-07-16 09:51:28 +12:00
|
|
|
|
2016-07-16 08:10:51 +12:00
|
|
|
return commands.check(predicate)
|
2016-07-16 09:39:26 +12:00
|
|
|
|
|
|
|
|
2016-07-09 13:27:19 +12:00
|
|
|
def isPM():
|
|
|
|
def predicate(ctx):
|
|
|
|
return ctx.message.channel.is_private
|
|
|
|
|
|
|
|
return commands.check(predicate)
|