projects
mastodon-markov
February 24, 2026
mastodon-markov is a Python bot that fetches posts from a source Mastodon account, trains a Markov chain on them, generates new text, and posts it to a destination account at random intervals between 30 minutes and 3 hours. It also periodically refreshes its dataset.
The Mastodon counterpart to bluesky-markov.
Status
Unmaintained.
Setup
pip install markovchain mastodon.py python-dotenv
Create .env in the project root:
MASTODON_BASE_URL=https://source.instance
MASTODON_ACCESS_TOKEN=your_source_token
DESTINATION_MASTODON_BASE_URL=https://dest.instance
DESTINATION_MASTODON_ACCESS_TOKEN=your_dest_token
DESTINATION_MASTODON_CHAR_LIMIT=500
SOURCE_MASTODON_ACCOUNT_ID=12345
Run:
python src/main.py
Press Ctrl+C to stop. The script runs continuously, posting at random intervals.
Structure
src/main.py— Orchestrationsrc/mastodon_client.py— API interactionssrc/markov_manager.py— Markov chain logic and dataset refreshsrc/text_cleaner.py— Text preprocessingsrc/post_manager.py— Posting logicsrc/refresh_schedule.py— Interval schedulingsrc/env_loader.py— Environment variable loading
Licence
See repository.
← all docs