A Python framework for easily creating Mastodon bots with pluggable content generation and filtering capabilities
Project description
RoboTooter
A Python framework for easily creating Mastodon bots with pluggable content generation and filtering capabilities.
Features
- Multiple Bot Types: Currently supports Markov chain-based text generation
- Flexible Filtering: Extensible filter system for processing input text (Gutenberg, blank line removal, paragraph combining)
- Mastodon Integration: Built-in support for posting to Mastodon instances
- CLI Interface: Easy-to-use command line interface for bot management
- Configuration Management: Simple bot configuration and data management
Installation
This project uses Poetry for dependency management. To install:
git clone <repository-url>
cd robotooter
poetry install
Quick Start
-
Configure the framework:
robotooter configure -
Create a new bot:
robotooter create-bot -
Set up your bot's data (for Markov bots, add a
sources.txtfile to the bot directory):robotooter --bot <bot-name> setup
-
Authorize your bot with Mastodon:
robotooter --bot <bot-name> authorize
-
Generate content locally:
robotooter --bot <bot-name> speak
-
Post to Mastodon:
robotooter --bot <bot-name> toot
Bot Types
Markov Bot
The Markov bot generates text using Markov chains trained on source material.
Setup Requirements:
- Create a
sources.txtfile in your bot's working directory - Each line should contain a URL to a text file to use as training data
- Run
robotooter --bot <bot-name> setupto download and process the sources
CLI Commands
robotooter info- Display information about the local setuprobotooter configure- Initialize configurationrobotooter create-bot- Create a new botrobotooter --bot <name> setup- Download and process bot training datarobotooter --bot <name> authorize [--force]- Authorize bot with Mastodonrobotooter --bot <name> speak [--count N]- Generate content locallyrobotooter --bot <name> toot- Generate and post content to Mastodon
Project Structure
src/robotooter/
\x00\x00 bots/ # Bot implementations
\x00\x00 base_bot.py # Base bot class
\x00\x00 markov/ # Markov chain bot
\x00\x00 cli/ # Command line interface
\x00\x00 filters/ # Text processing filters
\x00\x00 mastodon_manager.py # Mastodon API integration
\x00\x00 models.py # Data models
\x00\x00 util.py # Utility functions
Development
Requirements
- Python 3.12+
- Poetry for dependency management
Development Setup
poetry install --with dev
Running Tests
poetry run pytest
Code Quality
The project uses Ruff for linting and MyPy for type checking:
# Linting
./scripts/lint
# Type checking
./scripts/type
Dependencies
- requests: HTTP client for downloading source material
- markovify: Markov chain text generation
- mastodon.py: Mastodon API client
- pydantic: Data validation and settings management
- jinja2: Template engine
License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See the LICENSE file for details.
The AGPL-3.0 is a copyleft license that requires anyone who distributes the code or runs it on a server to make the source code available under the same license terms.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robotooter-0.1.0.tar.gz.
File metadata
- Download URL: robotooter-0.1.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21782c9690d8e84dcb23c9f30d9ea4ea2fba6cca633cfa8df7063ddb5b5dff57
|
|
| MD5 |
ee4cb10592274e8ea9569dfd7285bfa5
|
|
| BLAKE2b-256 |
ed955deb34d072365e407598ef23643031925ae473e1fae364404b46c453cafd
|
File details
Details for the file robotooter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: robotooter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7a47b72e38cf61265df5a3b0510a60c9ef204722967c322390c56ad42a59eb1
|
|
| MD5 |
326299a29f4746482f8578b25945bb2c
|
|
| BLAKE2b-256 |
779ce858697481d974a3f2621c5639e46c1e3f3a7e8068d596f8040d4f2bb142
|