The odd thing about personal bot projects is that after you’ve deployed them and they’re up and running, unless apis change and need to be updated, there’s not much needed to keep them running, if anything. Some of my first bots I deployed as AWS Lambdas I’ve had running several times a day for 5 years. In this time AWS Lambda supported runtimes have come and gone out of support, so the Node6 runtime I was originally using has now definitely passed it’s official support.
This is mostly a todo list to help consolidate my todo list of bots that I need to look at as part of my migration from Twitter to Mastodon, but if you search you can find my previous posts that describe how these were built.
Mostly migrated to @firstname.lastname@example.org on Mastodon but running on Twitter and Mastodon at the same time. Sends the same generated text to both at the same time, but replying to the bot either on Twitter or Mastodon will interact with just that bot on that account.
My first Twitterbot project, and has now tweeted over 11k times since 2018 when it went live. This comprises multiple Lambdas to provide different features:
a trained RNN text generation model generates random text and tweets every ~ 3 hours. One scheduled AWS Lambda generates the text and inserts to a DynamoDB table. Another scheduled Lambda reads the next tweet from the table and tweets using Twitter’s apis.
A scheduled Lambda runs every minutes calling a Twitter api to check for replies and tweets at this account. It replies with one of a number of canned replies
If you tweet at this bot with ‘go north|south|east|west it replies with a generated response typical of a text based adventure game. The replies are generated with a template and randomly inserted words (it isn’t actually a game)
A BlackJack cardgame bot. Not migrated to Mastodon yet. @ the bot with ‘deal’ to start a game. Tracks game state per player in DynamoDB. Uses Twitter apis to check for replies to the game bot every 5 minutes.
Like everyone else right now, I’m mulling options to migrate away from Twitter, likely to Mastodon (follow me at @email@example.com !). Moving my personal usage is relatively simple, other than rebuilding a list of people and tags that I like to follow. I also have a number of Twitter bots running on AWS Lambdas that I’ve built over the years that I should move at some point.
The easy part is that the code that’s running as an AWS Lambda doesn’t need to physically move anywhere, that can continue to run where it is. The part that needs to change is the APIs it’s using to integrate with Twitter and update them to use APIs to post to Mastodon instead.
I’m still in early stage of looking at options so far. I’ve discovered there’s a Mastodon instance, BotsInSpace, that’s specifically for running bots, so that addresses that first step, where they need to run against. I’ve also been reading through a few articles on developing bots for Mastodon such as this one. So far looks like it shouldn’t be too much of a big deal to move them across.
Twitter makes it incredibly easy to share random thoughts and links to topics of interest. For me personally, this is the main attraction of using Twitter, but the drawback of the brevity is that it discourages exploring and expanding a thought beyond 280 characters (how did we ever survive with only 140 characters?!)
After posting a short sentence about something I’m thinking about or have recently read elsewhere, I usually think “I could write a whole article on this single topic”. For example:
At some point in the near future we'll look back at the idea of the open office as one of the worst ideas ever conceived. A close second to the concept of the software factory. https://t.co/MNtZDjkOow
I could have easily taken this idea of open office spaces having the opposite intended effect on worker productivity and explored this in more depth in a longer article, but instead captured this thought as a single paragraph and left it at that.
In this sense I think Twitter makes us lazy. It makes it easy to quickly share a quick thought, but in doing so we throw out these nuggets of info and then leave them there, unexplored.
I don’t make New Years Resolutions, but if there’s one thing I plan to do more of this year, it’s to spend more time writing more articles, and less time sharing quick, throwaway thoughts.
I’ve built a few different bots on Twitter and written several articles describing how I built them. Some of these were a few months back – once they’re up and running it’s easy to forget they’re up and running (thanks to the free tier on AWS Lambda which means you can run scheduled Tweets well within the free tier limits). This is a summary of the bots I’ve developed so far.
Looking at where I got started, my first bot was to build an integration between Amateur Radio 2m Packet, retweeting packets received locally to Twitter. This was my first experience working with the Twitter REST apis and the OAUTH authentication, so I lot of what I learned here I reapplied to the following bots too:
For my next project, I was inspired by articles by researcher Janelle Shane who has been training ML models to produce some hilarious results, such as weird recipes, college course names and many others. I was curious what content a ML model would generate if I extracted all of my past 4000+ Tweets from Twitter and trained a model with the content. I had many questions, such as would the content be similar in style, and is 4000 Tweets enough text to train a model? You can follow my progress in these posts:
I had fun developing @kevinhookebot – it evolved over time to support a few features, not just to retweet content from the trained ML model. Additional features added:
an additional Lambda that consumes the Twitter API ‘mentions’ timeline and replies with one of a number of canned responses (not generated, they’re just hard coded phrases). If you reply to any of it’s tweets or Tweet @ the bot it will reply to you every 5 minutes when it sees a new tweet in the mentions timeline
another Lambda that responds to @ mentions to the bot as if it is a text-base adventure game. Tweet ‘@kevinhookebot go north’ (or east/west/south) and the bot will respond with some generated text in the style of an adventure game. There’s no actual game to play and it doesn’t track your state, but each response is generated using @GalaxyKate ‘s Tracery library to generate the text using a simple grammar that defines the structure of each reply.
After having fun with the adventure text reply generator, I also used the Tracey library for another AWS Lambda bot that generates product/project names and tweets every 6 hours. I think it’s rather amusing, you can check it out here: @ProductNameBot :
My most recent creation I upped the ante slightly and wondered what it would take to develop a Twitter bot that playeda card game. This introduced some interesting problems that I hadn’t thought about yet, like how to track the game state for each player. I captured the development in these posts here: