Statbot is a twitter bot that will randomly generate a set of retro video game stats for you, if you ask nicely:


I wanted to make a Twitter bot that would generate something new and unique for each and every person who interacted with it. I got the idea to generate stats pages, like you’d see in an old school RPG or adventure game. All people have to do is follow the account, tweet the “magic phrase,” and the bot will make them their very own stats image, customized with their username, display name, and profile pic.


Statbot is written in Ruby. I’m using a gem called IMGKit to generate the images. IMGKit takes HTML and CSS as inputs and spits out an image file.

Some of the stats are based on actual numbers (e.g. your experience points and level are based on how many times you’ve tweeted, how many followers you have, and a couple of other things) but mainly it’s entirely random. Despite the fact that almost everything is entirely random, “this is scarily accurate” is one of the most common reviews I see of Statbot. Go figure.

I used emojis for the icons as my drawing skills aren’t that great, and having to draw roughly 100 individual icons would’ve taken me forever. Also, the emojis helped with inspiration in the sense that the images already exist and I just had to create an attribute to match, rather than starting entirely from scratch.

The way it deals with requests is a bit janky. Basically it checks all recent mentions, sees which contain the “magic phrase,” and then compares that to the list of recent stats that have already been generated. If a user has made a proper request and doesn’t have a recent stats image generated for them then we make one. The bot checks its mentions and posts every 10 minutes, as it’s run on a free Heroku account and that’s the smallest interval you can use for scheduling tasks. There are also some rate limits in the code, both for accessing the Twitter API to check mentions and for tweeting, as you can only tweet roughly 100 times per hour and when the bot was first released it was hitting this limit fairly frequently, which would then break everything as you might imagine.


As of right now, Statbot has tweeted roughly 25,600 times. A handful of those are manual tweets announcing things and responding to people, but the vast majority of them represent a single stats image generated at a user’s request. When Statbot was first released it was actually popular enough to hit Twitter’s limit on number of tweets per hour (100) which is ultimately a good problem to have.

Here are some random pieces of feedback from people who used the bot: