From 43b2a13f90d62fd8dfa03e3fb955b40fc0ab05f0 Mon Sep 17 00:00:00 2001 From: Jacob Henry Date: Fri, 14 Sep 2018 00:29:18 -0400 Subject: [PATCH] Nag for any day --- job_nagger.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/job_nagger.py b/job_nagger.py index 458a356..d45264c 100644 --- a/job_nagger.py +++ b/job_nagger.py @@ -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)