Moved some manually-checked channel priveleges to blacklist mode
This commit is contained in:
parent
e6ec258466
commit
b925854cc5
|
|
@ -8,8 +8,6 @@ COMMAND_CENTER_ID = "GCR631LQ1"
|
|||
SLAVES_TO_THE_MACHINE_ID = "C9WUQBYNP"
|
||||
BOTZONE = "C3BF2MFKM"
|
||||
|
||||
NOT_ALLOWED_HERE = "There's a time and place for everything, but not here!"
|
||||
|
||||
|
||||
# Callback for telling what channel we in
|
||||
def channel_check_callback(slack, msg, match):
|
||||
|
|
|
|||
|
|
@ -20,10 +20,6 @@ class Job(object):
|
|||
|
||||
|
||||
def nag_callback(slack, msg, match):
|
||||
# Only allow in command center
|
||||
if msg["channel"] != channel_util.COMMAND_CENTER_ID:
|
||||
response = channel_util.NOT_ALLOWED_HERE
|
||||
else:
|
||||
# Get the day
|
||||
day = match.group(1).lower().strip()
|
||||
|
||||
|
|
@ -54,4 +50,4 @@ def nag_callback(slack, msg, match):
|
|||
slack_util.reply(slack, msg, response, in_thread=False, to_channel=channel_util.GENERAL)
|
||||
|
||||
|
||||
nag_hook = slack_util.Hook(nag_callback, pattern=r"nagjobs\s*(.*)")
|
||||
nag_hook = slack_util.Hook(nag_callback, pattern=r"nagjobs\s*(.*)", channel_whitelist=[channel_util.COMMAND_CENTER_ID])
|
||||
|
|
|
|||
|
|
@ -13,18 +13,11 @@ def list_hooks_callback_gen(hooks):
|
|||
# Gracefully reboot to reload code changes
|
||||
# noinspection PyUnusedLocal
|
||||
def reboot_callback(slack, msg, match):
|
||||
if msg["channel"] != channel_util.COMMAND_CENTER_ID:
|
||||
response = channel_util.NOT_ALLOWED_HERE
|
||||
reboot = False
|
||||
else:
|
||||
response = "Ok. Rebooting..."
|
||||
reboot = True
|
||||
|
||||
slack_util.reply(slack, msg, response)
|
||||
if reboot:
|
||||
exit(0)
|
||||
|
||||
|
||||
# Make hooks
|
||||
bot_help_pattern = r"bot help" # Can't init this directly, as it relies on us knowing all other hooks. handle in main
|
||||
reboot_hook = slack_util.Hook(reboot_callback, pattern=r"reboot")
|
||||
reboot_hook = slack_util.Hook(reboot_callback, pattern=r"reboot", channel_whitelist=[channel_util.COMMAND_CENTER_ID])
|
||||
|
|
|
|||
Loading…
Reference in New Issue