If you’re reading this, it’s safe to assume you use the internet. That being the case, you’ve almost certainly heard of Twitch through cultural osmosis at the very least. Twitch is a platform for streaming live video — particularly of video games. Tyler Pearce and his fiancée Kim like to stream video of them playing Overwatch together, and their dog Larry is one of the stars of the show. To reward Larry for being such a good boy, Tyler built a Twitch-controlled treat dispenser called LarryBot.
Tyler and Kim have streams over their own gameplay, but also have an additional live cam setup that features Larry. Viewers love watching Larry, and the couple thought it’d be fun to let them show their love by giving him treats. LarryBot is the result, and it uses an Express/MongoDB server to monitor Kim’s Twitch chat. A subscriber can simply type “!treat” into the chat, and Larry gets a delicious treat. Of course, a few requirements have to be met first so that Larry isn’t being given an unhealthy number of treats.
The first is that the server is running and ready to dispense treats. Second, it makes sure a treat hasn’t been dispensed in the last 30 seconds, and that a single subscriber isn’t spamming the treat command. Finally, it verifies that the person is actually a subscriber. If all is well, a NodeMCU ESP8266 triggers a 3D-printed feed mechanism to dispense a treat! Larry gets a nom nom, and Tyler and Kim’s Twitch followers get to interact with the real start of the show.