This is a very simple bot for Mastodon, written in Go. It uses the gronx
package for scheduling posts and the go-mastodon
package for interacting with the Mastodon API.
It is currently only capable of posting the same message whenever a time defined by CRON_SCHEDULE occurs
- Posts the same message to Mastodon at scheduled interval
- Configurable via environment variables
Variable | Description | Example |
---|---|---|
SERVER |
The Mastodon instance URL | https://mastodon.social |
CLIENT_ID |
The client ID for your Mastodon app | your_client_id |
CLIENT_SECRET |
The client secret for your Mastodon app | your_client_secret |
ACCESS_TOKEN |
The access token for your Mastodon app | your_access_token |
POST_TEXT |
The text to be posted by the bot | Hello, Mastodon! |
TZ |
The timezone for scheduling posts | America/New_York |
CRON_SCHEDULE |
The cron schedule for posts | * * * * * |
- Clone the repository
- Set the environment variables
- Run
go run main.go
export SERVER="https://mastodon.social"
export CLIENT_ID="your_client_id"
export CLIENT_SECRET="your_client_secret"
export ACCESS_TOKEN="your_access_token"
export POST_TEXT="Hello, Mastodon!"
export TZ="America/New_York"
export CRON_SCHEDULE="* * * * *"
go run main.go
You can also run this bot using Docker Compose. Here's an example of how to do it:
- Create a
docker-compose.yml
file in your project root with the content fromdefault.docker-compose.yml
- Replace the placeholder environment variables
- Run the command
docker compose up
in your terminal