At BuySellAds, we’re spread out geographically all around the world, across 10 cities in 5 countries. Sometimes in the midst of overhauling our product we need some digital fun to help strengthen our team.
So one morning while I was in a holding pattern waiting on a couple of UI screens for BSA v3, I whipped up our very own Donut Bot to hang out with us in Campfire.
How does it work? In its simplest form, the Donut Bot allows for team members to acknowledge favors or good work by sharing donuts. Just type
!give 10 Nathan for writing the Donut Bot and the transfer is complete.
But it doesn’t end there. The Donut Bot also offers a roulette wheel for anyone hoping to increase their donut count. Indicate your bet by typing
!roulette 10 red. It accepts red, black, even, odd, hi, lo, and any number straight-up. When all bets are in, one person types
!spin to let it fly. As a single-zero table, you’re better off with us than in Vegas.
The nature of gambling has proven interesting at BSA. For starters, many of us (myself included) are compulsive gamblers who should never set foot in a casino. Almost 1500 wagers have been placed since the bot took flight on March 1, with 250 of those on the first day alone. Donut bankruptcy has been reached at least a dozen times. Lesson learned.
Once the initial novelty wore off, though, we reset the totals, and upped the stakes, establishing a lottery at the end of March, where donuts were tickets.
!leaderboard lists the current donut leaders, and
!donuts indicates your own donut count. Of course, we used our very own
getAds function from our ad code to pick the winner of the lottery.
All in all, the dynamic of sharing donuts has been great. Between bonding over “we’re in it together, double or nothing” bets, helping each other out of donut bankruptcy, and in general just rewarding good deeds, the Donut Bot has been welcomed to our team with open arms.
I’m releasing the code in hopes that other remote teams can enjoy what we’ve been enjoying for the past month. It was put together hastily (we’ve got a ton of great stuff going on at BSA that keeps me busy), and I’m far from an expert in Node.js, so it may not be a shining example of how to write a Campfire bot, but it gets the job done.
It uses the node-campfire library to interface with Campfire. I had to patch it to automatically reconnect to rooms when Campfire drops the connection, but this actually got fixed before I had a chance to share my patch upstream, which is good to see. It also uses node-dirty to store the donut counts. More info on setting up is available in the README file.