Nag for any day

This commit is contained in:
Jacob Henry 2018-09-14 00:29:18 -04:00
parent 42e6a25e98
commit 43b2a13f90
1 changed files with 4 additions and 8 deletions

View File

@ -4,17 +4,13 @@ import slack_util
import google_api
import channel_util
nag_pattern = r"nagjobs (tuesday|thursday)"
nag_pattern = r"nagjobs\s*(.*)"
SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM"
eight_job_range = "House Jobs!A2:C25" # Format: Job Day Bro
fiftythree_job_range = "House Jobs!E2:G6"
# For matching purposes
tuesday = "tuesday"
thursday = "thursday"
class Job(object):
def __init__(self, house, job_name, day, brother_name):
@ -32,7 +28,7 @@ def nag_callback(slack, msg, match):
response = channel_util.NOT_ALLOWED_HERE
else:
# Get the day
day = match.group(1).lower()
day = match.group(1).lower().strip()
# Get the spreadsheet section
eight_jobs = google_api.get_sheet_range(SHEET_ID, eight_job_range)
@ -47,7 +43,7 @@ def nag_callback(slack, msg, match):
jobs = [j for j in jobs if j.day == day]
# Nag each
response = "Do your jobs! They are as follows:\n"
response = "Do yer jerbs! They are as follows:\n"
for job in jobs:
response += "({}) {} -- ".format(job.house, job.job_name)
ids = job.lookup_brother_slack_id()
@ -55,7 +51,7 @@ def nag_callback(slack, msg, match):
for id in ids:
response += "<@{}> ".format(id)
else:
response += "{} (scroll not found. Please register for @ notifications!)".format(job.brother_name)
response += "{} (scroll missing. Please register for @ pings!)".format(job.brother_name)
response += "\n"
slack_util.reply(slack, msg, response, in_thread=False, to_channel=channel_util.GENERAL)