A welcoming bot

ekardnam a2497a9cec Debug interface, updated broken dependencies 4 years ago
.env.dist 6eead9e714 Configuration and debug 4 years ago
.gitignore 61ecab9958 initial commit 5 years ago
Dockerfile 18db8f7f7e Dockerization and instructions 4 years ago
LICENSE 53ecbdfbcc adding MIT license 5 years ago
README.md a2497a9cec Debug interface, updated broken dependencies 4 years ago
message.template a2497a9cec Debug interface, updated broken dependencies 4 years ago
requirements.txt a2497a9cec Debug interface, updated broken dependencies 4 years ago
run.py a2497a9cec Debug interface, updated broken dependencies 4 years ago

README.md

Mastodon Welcome Bot

This is a Mastodon bot that sends out a welcome toot (DM) to new users, brought to you by jawns.club.

Because Mastodon's API doesn't currently have a route for getting an array of accounts in an instance, this bot queries the followers of an account and pages through for any have been created in the last x days (see configuration below). This means that you'll want ACCOUNT_ID to be an account that is auto-followed by all new users.

Installation/Development

Requires:

  • python3
  • pip

Steps with Docker

  1. git clone https://git.lattuga.net/ekardnam/mastodon-welcome-bot
  2. cd mastodon-welcome-bot
  3. cp .env.dist .env
  4. Fill in the env vars as required in the .env file (see definitions below)
  5. docker build . -t mastodon-welcome-message
  6. Run the app with docker run -d mastodon-welcome-bot

Steps without Docker

  1. git clone https://git.lattuga.net/ekardnam/mastodon-welcome-bot
  2. cd mastodon-welcome-bot
  3. virtualenv .venv
  4. source .venv/bin/activate
  5. pip install -r requirements.txt
  6. cp .env.dist .env
  7. Fill in the env vars as required in the .env file (see definitions below)
  8. python3 run.py

Environment Variables

The application uses the following environment variables.

name required default description
ACCESS_TOKEN yes n/a the access token for the Mastodon account that you want the toots to come from
INSTANCE_BASE_URL yes n/a the base url of the Mastodon instance you want to run this for (ex: "https://jawns.club")
DEBUG no false boolean (either "true" or "false") for debug mode. If true, won't actually send out the toots, will just print the message for each to stdout
ACCOUNT_ID yes n/a the account ID that you want to pull followers from
INSTANCE_MAX_CHARS no 500 the max char length a toot can have

In file message.template put the template of the toot that you want to send out. Jinja2 syntax is used here and you can use any of the Account variables.