TimberBot

TimberBot is a general-purpose chat bot extensible via plugins and geared towards public chat rooms, particularly Twitch. It supports user roles and reacts to commands.

Demo

Background

Back in 2014 I used to visit a Twitch.tv stream with a small community attached. The initial version of TimberBot was not even developed for practical purposes, but just because we thought having a customizable chat bot around would be funny. What started as a tiny IRC bot with responses based on a small set of hardcoded conditionals quickly grew into a relatively full-featured bot that was able to support moderation processes and make chat communication a bit more engaging.

I made the bot available as a free service to a few friends with the shared understanding that they’d be part of a testing process and that it might fail in unpredictable ways. In its heyday, TimberBot supported around half a dozen Twitch communities of different sizes. My centralized TimberBot hosting has been gradually wound down since, and the code has been released as free software. To my knowledge, there is one community remaining which is self-hosting TimberBot.

Technical Achievements

TimberBot plugin example

My desire was to make plugin development straightforward. All a plugin needs to do is implement a few specifically named functions to tap into the message loop.

The two most interesting aspects of TimberBot are its plugin system and its chat service versatility.

When it became untenable to keep all chat functionality in one big script, I decided to split it apart into plugins which the bot owner could then load and unload at runtime. This way, parts of the code that the owner does not intend to use cannot cause issues. Loading Python modules at runtime is fairly simple and the bot’s codebase does all necessary error handling so a faulty plugin will not bring the whole bot down.

Timberbot was initially developed to connect to Twitch chat, which uses an IRC gateway. Connectors were later developed for general IRC servers, Picarto, Hitbox (discarded in 2016), Twitter direct messages (discarded in 2019) and Discord (discarded in 2022). I began work on connectors for Slack and YouTube Gaming, but dropped the efforts when it started to look like familiarizing myself with their APIs would not be worth the effort.

Project Perspective

I have gone back and forth on what to do with TimberBot. At one point I wanted it to become a full-fledged service solution and even put initial considerations into a business plan. At its highest point, my own TimberBot installation serviced about a dozen channels across three chat services. None of them were particularly big and I don’t think TimberBot ever funneled more than a few thousand messages per day, but I had aspirations for it.

Regrettably, TimberBot’s formative years coincided with my transition from university studies into full-time employment and I found myself not having the free time necessary to turn it into a software service suitable for public use. With the bot in long-term use by some Twitch channels, issues in reliability became apparent: the bot would sometimes appear to “miss” individual messages or randomly drop out of the chat altogether. I was never able to find the true causes for these problems that appeared to be exclusive to long-term use scenarios, which made things challenging to test. Band-aid fixes were put in place, including a forced reset every 24 hours to reestablish any dropped network connections, but when it became increasingly apparent that TimberBot was not reliable enough to be trusted with essential moderation tasks, I also scaled back my aspirations for expansion.

There are other issues with TimberBot that are more architectural than practical. Early on I made the decision that all bot configuration and administration would take place in the same chat where the bot is used, via administrative commands. This simplified the project a great deal, since it did not need an interactive website that would allow for graphical configuration. But with the plugins now numbering almost 40, the strain that this decision puts on the bot owners (to memorize all the important commands and their syntax) has emerged as a limiting factor that makes me reluctant to add more complexity. At the same time, re-engineering the bot to have a proper interactive GUI would be such an involved task that it may as well be an entirely new project.

Over the years since 2017, most of the remaining TimberBot communities have gradually phased it out as community management on Twitch has evolved and my personal availability for assistance has suffered. Some channel owners have relished the chance to introduce ideas for custom plugins with me as the coder, but I also think there is little hope for long-term growth. At the end of 2022 I decided to finally publish TimberBot as an open source project (after simplifying some of the code and removing legacy parts) in hopes of allowing people to self-host it and modify it to suit their needs. The last community that was using a centrally hosted TimberBot shut down in 2023, now there is one community still left that is self-hosting a custom variant.