DEV Community

Cover image for A Slack Bot for your private Advent of Code Leaderboard
Jean-Francis Bastien
Jean-Francis Bastien

Posted on

5

A Slack Bot for your private Advent of Code Leaderboard

Slack Bot for the Advent of Code

In this festive time, a colleague created a private Leaderboard and invited every dev where I work to participate. I was very exited and after completing the first challenge I thought something was missing to engage others.

A Slack Bot that show the progress of every participants.

Thanks to this repo, tomswartz07/AdventOfCodeLeaderboard that gave me the idea.

I didn't want something that posted every 10 minutes with the same score. So I made a Rails app (because this's what I know) that will check if someone gained a ⭐️, save it and then send the new LeaderBoard.

GitHub logo Bhacaz / Advent-of-Code-Slack-Bot

Advent of Code Leaderboard bot

Advent of code Slack Bot

This is a Slack bot to post a Advent of code Private Leaderboard to a Slack channel when someone complete a challenge.

Screen Shot 2019-12-05 at 16 24 14

Prerequisites:

  • slack_url: An Incoming WebHooks url for workplace Slack.
  • slack_channel: The name of the channel you want to post the LeaderBoard
  • session: A cookie session token from Advent of Code. It can be find in a request header in the devtool of your browser.
  • leaderboard_id: The ID of your private Leaderboard. It can be found at the end of the url of your Leaderboardhttps://adventofcode.com/2019/leaderboard/private/view/<<XXXXX>>>

You can create a config/application.yml file to set those env variables

Running:

  • Run the Rails server bin/rails server
  • Create a cron job that will fire the Incoming WebHooks if someone recently complete a challenge every 10 minutes.
$ EDITOR=nano crontab -e
Enter fullscreen mode Exit fullscreen mode
  • Add this line
*/10 * * * * curl http://localhost:3000/api/exec_webhook
Enter fullscreen mode Exit fullscreen mode

Build on:

Have a look and happy Advent of Code

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay