Restructuring / refactoring my Mastodon ZorkBot

Now my ZorkBot is working over at @zorkbot@botsin.space I’ve restructured the 3 Lambdas so it’s easier to follow what calls what.

In it’s current/initial working state, I built it with 3 AWS Lambdas:

mastodon-zorkbot

This Lambda runs every 5 minutes, checking for players messaging the bot

  • checks for last replied to messages so it only replies to a message once, using a DynamoDB table
  • if a new reply is needed, sends the game move command from the player to the next Lamdba, mastodonbot-aws-sdk2
  • replies to the player using the Mastodon APIs

The Lambda is deployed as: mastodonbot-zorkbot-dev-mastodon-reply

mastodonbot-aws-sdk2

This Lambda is called by mastodon-zorkbot, and provides parsing of the text responses from the frotz Custom Runtime Lambda, which is calls next

custom-lambda-zork

This is a Docker image for a Custom Lambda Runtime that invokes the frotz binary. This is the zmachine game runtime that runs the Zork game. It could be updated to run any game supported by frotz. The Custom Runtime has a shell script that pipes echo commands into frotz, captures the response and retuns to mastodonbot-aws-sdk2

The Refactoring

For first steps I’m just going to rename the folders of each of the Lamdbas and the serverless.yml service names so it’s easier to track what calls what in sequence:

mastodon-zorkbot -> zorkbot-1-mastodonreplies

mastodonbot-aws-sdk2 -> zorkbot-2-responseparser

custom-lambda-zork -> zorkbot-3-frotzcustomruntime

Will update later with progress.