2022-08-15 12:24:32 +03:00
|
|
|
# Mastodon group bot
|
|
|
|
This is a bot which implements group functionality in Mastodon.
|
|
|
|
|
2022-08-26 02:34:01 +03:00
|
|
|
## Features
|
|
|
|
* Repost toots
|
|
|
|
* Welcome message of new members
|
|
|
|
* Limit of toots per hour
|
2022-09-01 14:31:27 +03:00
|
|
|
* Duplicate protection
|
|
|
|
* Logging
|
2022-08-26 02:34:01 +03:00
|
|
|
* Admin commands
|
2022-08-15 12:24:32 +03:00
|
|
|
|
2022-08-26 13:56:21 +03:00
|
|
|
### Admin commands
|
|
|
|
* unboost \<Toot ID>
|
|
|
|
* delete \<Toot ID>
|
|
|
|
|
2022-08-26 02:34:01 +03:00
|
|
|
# Configuration
|
2022-08-15 12:24:32 +03:00
|
|
|
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"
|
2022-09-01 14:31:27 +03:00
|
|
|
"Max_toots": 2,
|
|
|
|
"Toots_interval": 12,
|
|
|
|
"Duplicate_buf": 10,
|
2022-08-25 22:23:44 +03:00
|
|
|
"Admins": ["admin@example.com"]
|
2022-08-15 12:24:32 +03:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
# Building
|
|
|
|
```
|
|
|
|
go mod init mastodon-group-bot
|
|
|
|
go mod tidy
|
|
|
|
go build
|
|
|
|
```
|
|
|
|
|
2022-08-26 02:34:01 +03:00
|
|
|
# Setup services
|
2022-08-28 19:37:43 +03:00
|
|
|
For first make dirs, copy config and binary
|
2022-08-26 02:34:01 +03:00
|
|
|
```
|
2022-08-26 13:56:21 +03:00
|
|
|
mkdir /etc/mastodon-group-bot
|
|
|
|
mkdir /var/lib/mastodon-group-bot
|
2022-08-28 19:37:43 +03:00
|
|
|
mkdir /var/log/mastodon-group-bot
|
2022-08-26 13:56:21 +03:00
|
|
|
chown nobody /var/lib/mastodon-group-bot
|
2022-08-28 19:37:43 +03:00
|
|
|
chown nobody /var/log/mastodon-group-bot
|
2022-08-26 13:56:21 +03:00
|
|
|
cp config.json /etc/mastodon-group-bot/config.json
|
2022-08-28 19:37:43 +03:00
|
|
|
cp mastodon-group-bot /usr/bin/mastodon-group-bot
|
2022-08-26 02:34:01 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Systemd
|
|
|
|
```
|
|
|
|
cp ./services/systemd/mastodon-group-bot.service /etc/systemd/system/mastodon-group-bot.service
|
|
|
|
```
|
2022-08-15 12:24:32 +03:00
|
|
|
|
2022-08-26 02:34:01 +03:00
|
|
|
## OpenRC
|
|
|
|
```
|
|
|
|
cp ./services/openrc/mastodon-group-bot /etc/init.d/mastodon-group-bot
|
|
|
|
```
|
|
|
|
|
|
|
|
# Usage
|
2022-08-15 12:24:32 +03:00
|
|
|
```
|
2022-08-28 19:37:43 +03:00
|
|
|
mastodon-group-bot -config <path> -db <path> -log <path>
|
2022-08-15 12:24:32 +03:00
|
|
|
```
|