ewanc26 / mastodon-markov

a Mastodon bot based on a set of posts digested by the Markov chain.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mastodon Markov Bot

No Maintenance Intended

This Python script generates Markov chain text based on the posts of a Mastodon account and posts them to another Mastodon account. It also periodically updates its dataset and posts a new status.

Setup

  1. Clone this repository or download the script chain.py.

  2. Install the required dependencies by running:

    pip install markovchain mastodon.py python-dotenv
  3. Create a .env file in the same directory as the script and add the following variables:

    MASTODON_BASE_URL=<source Mastodon instance base URL>
    MASTODON_ACCESS_TOKEN=<source Mastodon account access token>
    DESTINATION_MASTODON_BASE_URL=<destination Mastodon instance base URL>
    DESTINATION_MASTODON_ACCESS_TOKEN=<destination Mastodon account access token>
    DESTINATION_MASTODON_CHAR_LIMIT=<destination Mastodon character limit>
    SOURCE_MASTODON_ACCOUNT_ID=<source Mastodon account ID>

Usage

  1. Run the script by executing in the repository directory:

    python chain.py
  2. The script will fetch recent posts from the source Mastodon account, generate Markov chain text, and post it to the destination Mastodon account at random intervals between 30 minutes and 3 hours.

  3. Press Ctrl+C to stop the script.

Notes

  • Ensure that both the source and destination Mastodon accounts have appropriate permissions and visibility settings for posting.
  • If you need to change any Mastodon or environment variables, update them in the .env file.
  • Make sure to customise the script according to your needs, such as adjusting the character limit for generated text or the update interval for the dataset.

About

a Mastodon bot based on a set of posts digested by the Markov chain.

License:MIT License


Languages

Language:Python 100.0%