Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification scheduling #69

Merged
merged 5 commits into from
Jul 22, 2019
Merged

Notification scheduling #69

merged 5 commits into from
Jul 22, 2019

Conversation

mqp
Copy link
Contributor

@mqp mqp commented Jul 19, 2019

This is aimed to be a simple tool that Liv can try out to see whether it's worth having, or worth fleshing out somehow, or things like that. Here is how it works:

  • If you type !hubs notify set [datetime] with a date the bot can parse (e.g. 7/18/19 19:00), the bot will make a message saying that a meetup notification has been scheduled, and pin the message. Note that the timezone is assumed to be the bot's default timezone if not otherwise specified -- in our deployment, that's PT.
  • When the date comes, the bot will unpin the message and send a message notifying @ here to join the hub.
  • It's OK to pile up multiple notifications like this. The bot will send a message at each future time. If you're curious what notifications there are, you should look at the pinned messages.
  • Notifications fire at the start of the minute and only have a one-minute resolution, so if you make a notification at 19:30:06 it will just message you are 19:30:00 (by our clock) anyway.
  • If the bot is down (unlikely, but possible) when the notification is supposed to fire, you won't get it, and it won't fire when the bot comes back up, so you probably shouldn't rely on using these notifications to remind you to take your medication every morning for the rest of your life because someday eventually you won't take it.
  • If you type !hubs notify clear, the bot will delete any pinned notification messages and cancel the corresponding pending notifications.

Right now, the bot won't respect pins/unpins/deletions of notification messages that you do manually until it restarts (which happens at arbitrary times, when we deploy stuff), so you probably shouldn't do that if you want to keep the pending notification behavior legible. You might also get odd results if you do things like take away and give back the bot's permissions at strategic times, and so on. I'm really only trying to handle the reasonable cases here so that we can test this out.

Note that the bot needs "manage messages" permission in order to pin or unpin messages, so none of this will work if you don't grant it in the channels you want it to operate in.

@mqp mqp merged commit 25b5cdc into master Jul 22, 2019
@mqp mqp deleted the scheduling branch July 22, 2019 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant