You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
750B

  1. from discord.ext import commands
  2. import load_config
  3. from config.server_config import ServerConfig
  4. def is_bot_owner():
  5. return commands.check(lambda ctx: ctx.message.author.id == load_config.owner)
  6. def is_owner_or_admin():
  7. def predicate(ctx):
  8. if ctx.message.author.id == load_config.owner:
  9. return True
  10. else:
  11. for role in ctx.message.author.roles:
  12. if role.id in ServerConfig().load_config()[ctx.message.server.id]["perm_roles"]["admin"]:
  13. return True
  14. return False
  15. return commands.check(predicate)
  16. def is_nfsw_enabled():
  17. return commands.check(lambda ctx: ServerConfig().load_config()[ctx.message.server.id]["nsfw"]["enabled"] == 1)
  18. def is_gss():
  19. return commands.check(lambda ctx: ctx.message.server.id == "393764974444675073")