1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +12:00
Bonfire/cogs/utils/checks.py

32 lines
777 B
Python

from discord.ext import commands
from . import config
def isOwner(ctx):
return ctx.message.author.id == config.ownerID
def customPermsOrRole(perm):
def predicate(ctx):
nonlocal perm
if ctx.message.channel.is_private:
return False
custom_permissions = config.getContent('custom_permissions')
try:
perm = custom_permissions[ctx.message.server.id][str(ctx.command)]
except KeyError:
pass
if perm == "none":
return True
return getattr(ctx.message.author.permissions_in(ctx.message.channel),perm)
return commands.check(predicate)
def isPM():
def predicate(ctx):
return ctx.message.channel.is_private
return commands.check(predicate)