Mostly as a test, to get a feel for the tool
|3 weeks ago|
|LICENSES||3 weeks ago|
|.gcloudignore||3 weeks ago|
|.gitignore||3 weeks ago|
|README.md||3 weeks ago|
|app.yaml.template||3 weeks ago|
|chat_commands.go||3 weeks ago|
|cron.yaml||3 weeks ago|
|main.go||3 weeks ago|
|poller.go||3 weeks ago|
|webex_functions.go||3 weeks ago|
After the success of the Advent of Code bot of last year I decided to this year up the ante and actually get it to listen for commands and be able to host multiple Webex Teams rooms and associated Advent of Code leaderboards.
The address of the bot currently running in production is: AdventLeaderBot@webex.bot You can add the Bot to a room or talk to it directly, but remember to always @-mention it to give it any commands when it's part of a room.
The bot uses the custom github.com/michielappelman/leaderboard Go package to retrieve the leaderboard JSON files and updates the rooms that subscribed to those leaderboards every 5 minutes, if there are changes.
There are four commands defined currently to control the behaviour of the bot once it's added to a Webex Teams room:
register 12345 xyzwhich will register the room with a certain leaderboard and the required session Cookie for the adventofcode.com website.
poll, polls the current standing of the leaderboard and updates the room.
year 2018will set the year to poll for this room.
helpwill give an overview of the commands and the current settings for the room.
Google App Engine
The bot is built to be run on GAE and makes use of the GCP Datastore to store Room subscriptions. Files related to the GAE deployment:
app.yamlfile requires the Environment Variable
WEBEX_TEAMS_TOKENset for the Webex Teams Bot auth token..
cron.yamlspecifies the 5 minute interval for polling the leaderboards for all the rooms.
- Set a timer for invalid API failures, to stop the bot from spamming when the cookie expires.
- Match Webex Teams user ID's with player names, to know who's who.