Bluesky film script bots

Tiny automated accounts posting film dialogue to Bluesky, one line at a time.

Made with: Val Town, Turso, Bluesky API

What are they and how do they work?

Each bot, like @robocop1987.bsky.social, runs as a small Val Town script on a cron job every 30 minutes. When it wakes up, it loads the bot's saved state from a SQLite database, fetches the matching script text from a shared Val Town film scripts project, and posts the next line to Bluesky.

The database keeps track of the current line number for each bot, along with the saved Bluesky session JSON, so the bots can resume cleanly without logging in from scratch every time. After posting, the bot increments the line number and wraps back to the start when it reaches the end of the script.

Environment variables

Each scheduled Val Town bot uses a small set of environment variables so the same script can be reused for different films and accounts.

BLUESKY_SHORTNAME
The bot key used to find the right row in the database, for example robocop1987.
BLUESKY_USERNAME
The Bluesky account identifier the bot logs in as.
BLUESKY_PASSWORD
The Bluesky app password used when a saved session cannot be resumed.
MOVIE_SCRIPT_FILE
The filename to fetch from the public film scripts val, for example robocop-1987.txt.
TURSO_DATABASE_URL
The database URL that stores each bot's session and current line number.
TURSO_AUTH_TOKEN
The auth token used to read and update the bot state.

The database

There's not much to it: a single SQLite table with one row per bot, storing the bot name, the saved Bluesky session JSON, and the next line number to post.

Example SQLite state table
id integer bot_name text session_json text next_line integer
1 jaws-1975 {"handle":"jaws-1975.bsk..."} 286
2 ghostbusters1984 {"handle":"ghostbusters1..."} 998
3 robocop1987 {"did":"did:plc:sgjhrd3n..."} 556
4 bigtrouble1986 {"did":"did:plc:zspufqxx..."} 198
5 diehard1988 {"did":"did:plc:jwf4ikc4..."} 1087
6 princessbride1987 {"handle":"princessbride..."} 65
7 theroyaltenenbaums {"handle":"theroyaltenen..."} 151
8 thelighthouse-2019 {"handle":"thelighthouse..."} 353
9 bottoms-2023 {"did":"did:plc:xnllj2mq..."} 909

Film script bots