2018-12-26 07:55:42 +00:00
|
|
|
import config
|
|
|
|
|
2019-03-05 17:33:19 +00:00
|
|
|
|
2018-12-26 07:55:42 +00:00
|
|
|
def check_if_staff(ctx):
|
|
|
|
if not ctx.guild:
|
|
|
|
return False
|
|
|
|
return any(r.id in config.staff_role_ids for r in ctx.author.roles)
|
|
|
|
|
|
|
|
|
|
|
|
def check_if_bot_manager(ctx):
|
|
|
|
if not ctx.guild:
|
|
|
|
return False
|
|
|
|
return any(r.id == config.bot_manager_role_id for r in ctx.author.roles)
|
|
|
|
|
|
|
|
|
|
|
|
def check_if_staff_or_ot(ctx):
|
|
|
|
if not ctx.guild:
|
|
|
|
return True
|
|
|
|
is_ot = (ctx.channel.name == "off-topic")
|
2019-01-29 10:16:48 +00:00
|
|
|
is_bot_cmds = (ctx.channel.name == "bot-cmds")
|
2018-12-26 07:55:42 +00:00
|
|
|
is_staff = any(r.id in config.staff_role_ids for r in ctx.author.roles)
|
2019-01-29 10:16:48 +00:00
|
|
|
return (is_ot or is_staff or is_bot_cmds)
|
2019-03-02 23:40:43 +00:00
|
|
|
|
2019-03-05 17:33:19 +00:00
|
|
|
|
2019-03-02 23:40:43 +00:00
|
|
|
def check_if_collaborator(ctx):
|
2019-04-18 19:30:32 +00:00
|
|
|
if not ctx.guild:
|
|
|
|
return False
|
2019-03-05 17:33:19 +00:00
|
|
|
return any(r.id in config.staff_role_ids + config.allowed_pin_roles
|
|
|
|
for r in ctx.author.roles)
|
2019-03-02 23:40:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def check_if_pin_channel(ctx):
|
2019-04-18 19:30:32 +00:00
|
|
|
if not ctx.guild:
|
|
|
|
return False
|
2019-03-02 23:40:43 +00:00
|
|
|
return ctx.message.channel.id in config.allowed_pin_channels
|