/magic-realism-dream-bot

A Twitter bot that feeds magical realism prompts into the Stable Diffusion AI image generator.

Primary LanguageTypeScriptMIT LicenseMIT

Illustrated Magical Realism Bot

Follow the bot on Twitter

Follow @ImagicalRealism to see the generated output.

Technical details

The Twitter API

This bot uses the fantastic twitter-api-v2 library to interact with Twitter.

OAuth 1.0a tokens are used for authentication. I followed the library's guide to generate all of the necessary tokens.

Generating images

The Stability Diffusion API's gRPC service generates an image for a given prompt.

The @grpc/grpc-js library talks to the backend service. You can find details on how the gRPC client definitions were generated in the proto directory.

Running the bot

A GitHub Actions workflow definition executes npm run tweet on a one-hour schedule. If there is already a generated image for the latest @MagicRealismBot tweet, then npm run tweet will exit without posting anything.