🦉 Keeping an eye on the Hack Club Slack's #counttoamillion channel
Find a file
2022-08-23 15:33:16 -04:00
.github/workflows Add build workflow 2020-07-31 18:54:45 -07:00
cmd Possibly fix timezone thing 2021-05-02 15:56:01 -04:00
pkg/jia celesteblocker 2022-08-23 15:33:16 -04:00
.gitignore Add Makefile 2020-07-27 00:28:46 -07:00
captain-definition add dockerfile 2020-12-23 10:58:09 -05:00
Dockerfile Update to Go 1.16 2021-05-02 15:43:41 -04:00
events.yaml Update event 2021-06-08 21:11:06 -04:00
go.mod Events system 2021-05-02 15:39:41 -04:00
go.sum Events system 2021-05-02 15:39:41 -04:00
LICENSE.txt Create savepoint 2020-06-30 02:23:49 -07:00
Makefile Add Makefile 2020-07-27 00:28:46 -07:00
README.md Rename bot token environment variable 2020-08-04 02:05:17 -07:00

🦉 Jia

Keeping an eye on the Hack Club Slacks #counttoamillion channel.

Setup

Creating the Slack app

Youll need to create a Slack app (not a classic one) with at least the following bot token scopes. The reasons each scope is required are also included:

  • channels:history (or groups:history, if its a private channel): Used to listen to messages sent.
  • chat:write: Used for sending messages.
  • reactions:write: For reacting to invalid messages.

Then youll need to subscribe the app to a few events. The server has an endpoint open at /slack/events, so when youre asked for a request URL, just put https://<SERVER>/slack/events. Only the following events are needed:

  • message.channels (or message.groups if its a private channel)

Environment variables

Here are all the variables you need to set up, with hints.

# The port to run the app server on
PORT=3000
# Redis database to store the last number and its sender
REDIS_URL=redis://…
# App config. Obtained from the "Basic Information" page of your app.
SLACK_BOT_TOKEN=xoxb-…
SLACK_VERIFICATION_TOKEN=xxxx…
# The channel where Jia should validate counted numbers in.
SLACK_CHANNEL_ID=C…

Deploying

# Run it…
make

# …or build a binary and run that instead
make build
./bin/jia

After youve followed all the above steps, you should see something like this:

Starting Jia…
Listening on port 3000

License

MIT License