Emojified RC check-in reminders broadcast on Zulip 🌇 💻 🐙 🕥 🚨
John J. Workman (@workmajj)
I worked on this software during my time as a Recurse Center facilitator. If you'd like to join a warm community of programmers dedicated to self-improvement, you should consider applying. :-)
I use this program at RC to announce our regularly scheduled check-ins automatically. Because sending a message via Zulip is as easy as making a POST
request, I tried complicating things by working in C, and by implementing a simple template language for the messages.
When cronmoji
runs, it gets the current time, rounds to the nearest half-hour, and then uses this info to evaluate a random message template. Templates can specify adding the time as a string ($t
), adding a clock emoji ($c
), or adding three randomly selected fun/goofy emoji ($e
). The final message string is published to the Zulip stream and topic specified as command-line args.
Features I won't be adding, because this is a silly project:
- loading template string and emoji arrays from external files
- pinging specific people rather than the whole group
- making the program into an interactive bot that runs in the background
This project will eventually be obsoleted by internal RC tools.
-
After cloning the project, open
src/tpl.h
and customize the array of message templates and/or the array of fun emoji (of whichTPL_NUM_EMOJI
are randomly chosen):const size_t ZULIP_TPL_SIZE = 12; const char *ZULIP_TPL[] = { "$c Yay, @**all**, it's time for $t check-ins! $e", "$e @**all** Yo, it's time $c for $t check-ins!", "$e Get excited, y'@**all**, 'cause it's $t check-in time! $c", ... "Heads up, @**all**, it's time for $t $c check-ins! $e", "Hey @**all**, it's $t check-in time! $c $e", "ZOMG @**all**, it's $t check-in time! $c $e" }; const size_t ZULIP_EMOJI_SIZE = 48; const char *ZULIP_EMOJI[] = { ":100:", ":art:", ":clap:", ... ":volcano:", ":watch:", ":zap:" };
-
Next, build the program from source:
$ make
-
Then set up your environment to export the appropriate Zulip API credentials. These can be sourced from your
.bashrc
if you'll be runningcronmoji
repeatedly:$ export CRONMOJI_EMAIL=<your-zulip-api-email> $ export CRONMOJI_KEY=<your-zulip-api-key>
-
Now you can test
cronmoji
manually (a dedicated Zulip test stream might be good):$ ./cronmoji <zulip-test-stream-name> <zulip-topic-name> {"msg":"","result":"success","id":12345678} @**all** 1:00 check-in time :clock1: has arrived! :octopus: :computer: :smile:
-
Finally, add to
launchd
orcron
to run at certain intervals. Remember that the time will round to the nearestTIME_TICK_MINS
(defined insrc/time.c
as30
by default) when announcing check-ins. So a job that runs at 12:40, for example, will round to12:30
; but jobs at 12:45 and 12:50 will round to1:00
. All times are in 12-hour format because of emoji availability.
This software is published under the terms of the BSD 3-clause license.
See the LICENSE file for more info.