Nagging only in CC
This commit is contained in:
parent
bc25ffcb1e
commit
8d1168d5eb
|
|
@ -8,6 +8,8 @@ COMMAND_CENTER_ID = "GCR631LQ1"
|
||||||
SLAVES_TO_THE_MACHINE_ID = "C9WUQBYNP"
|
SLAVES_TO_THE_MACHINE_ID = "C9WUQBYNP"
|
||||||
BOTZONE = "C3BF2MFKM"
|
BOTZONE = "C3BF2MFKM"
|
||||||
|
|
||||||
|
NOT_ALLOWED_HERE = "There's a time and place for everything, but not here!"
|
||||||
|
|
||||||
# Define our patterns
|
# Define our patterns
|
||||||
channel_check_pattern = r"channel id\s*(.*)"
|
channel_check_pattern = r"channel id\s*(.*)"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,29 +27,31 @@ class Job(object):
|
||||||
|
|
||||||
|
|
||||||
def nag_callback(slack, msg, match):
|
def nag_callback(slack, msg, match):
|
||||||
# Only allow in
|
# 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()
|
||||||
|
|
||||||
# Get the day
|
# Get the spreadsheet section
|
||||||
day = match.group(1).lower()
|
jobs = google_api.get_sheet_range(SHEET_ID, eight_jobs)
|
||||||
|
jobs = jobs + google_api.get_sheet_range(SHEET_ID, fiftythree_jobs)
|
||||||
|
jobs = [Job(r) for r in jobs]
|
||||||
|
|
||||||
# Get the spreadsheet section
|
# Filter to day
|
||||||
jobs = google_api.get_sheet_range(SHEET_ID, eight_jobs)
|
jobs = [j for j in jobs if j.day == day]
|
||||||
jobs = jobs + google_api.get_sheet_range(SHEET_ID, fiftythree_jobs)
|
|
||||||
jobs = [Job(r) for r in jobs]
|
|
||||||
|
|
||||||
# Filter to day
|
# Nag each
|
||||||
jobs = [j for j in jobs if j.day == day]
|
response = "Do your jobs! They are as follows:\n"
|
||||||
|
for job in jobs:
|
||||||
# Nag each
|
response += "{} -- ".format(job.job_name)
|
||||||
response = "Do your jobs! They are as follows:\n"
|
ids = job.lookup_brother_slack_id()
|
||||||
for job in jobs:
|
if ids:
|
||||||
response += "{} -- ".format(job.job_name)
|
for id in ids:
|
||||||
ids = job.lookup_brother_slack_id()
|
response += "<@{}> ".format(id)
|
||||||
if ids:
|
else:
|
||||||
for id in ids:
|
response += "{} (scroll not found. Please register for @ notifications!)".format(job.brother_name)
|
||||||
response += "<@{}> ".format(id)
|
response += "\n"
|
||||||
else:
|
|
||||||
response += "{} (scroll not found. Please register for @ notifications!)".format(job.brother_name)
|
|
||||||
response += "\n"
|
|
||||||
|
|
||||||
slack_util.reply(slack, msg, response, in_thread=False, to_channel=channel_util.BOTZONE)
|
slack_util.reply(slack, msg, response, in_thread=False, to_channel=channel_util.BOTZONE)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue