Mirror fade + extend code Mastodon group bot which reposts toots
Go to file
2022-08-25 19:34:01 -04:00
services add services 2022-08-25 19:34:01 -04:00
.gitignore add services 2022-08-25 19:34:01 -04:00
bot.go add limits 2022-08-25 15:23:44 -04:00
config.go add limits 2022-08-25 15:23:44 -04:00
config.json add limits 2022-08-25 15:23:44 -04:00
limits.go add limits 2022-08-25 15:23:44 -04:00
main.go add limits 2022-08-25 15:23:44 -04:00
README.md add services 2022-08-25 19:34:01 -04:00

Mastodon group bot

This is a bot which implements group functionality in Mastodon.

Features

  • Repost toots
  • Welcome message of new members
  • Limit of toots per hour
  • Admin commands

Configuration

The bot is configured in a JSON file that looks like this:

{
    "Server":           "https://example.com",
    "ClientID":         "0000000000000000000000000000000000000000000",
    "ClientSecret":     "0000000000000000000000000000000000000000000",
    "AccessToken":      "0000000000000000000000000000000000000000000",
    "WelcomeMessage":   "We have a new member in our group. Please love and favor"
    "Max_toots":        1,
    "Toots_interval":   24,
    "Admins":           ["admin@example.com"]
}

Building

go mod init mastodon-group-bot
go mod tidy
go build

Setup services

For first copy config and binary

cp mastodon-group-bot /usr/bin/mastodon-group-bot
cp config.json /etc/mastodon-group-bot.json

Systemd

cp ./services/systemd/mastodon-group-bot.service /etc/systemd/system/mastodon-group-bot.service

OpenRC

cp ./services/openrc/mastodon-group-bot /etc/init.d/mastodon-group-bot

Usage

Usage of mastodon-group-bot:
  -config string
        Path to config (default "config.json")