mirror of
https://git.phreedom.club/localhost_frssoft/mastodon-group-bot.git
synced 2024-11-18 08:33:02 +00:00
add services
This commit is contained in:
parent
fe88a07676
commit
f013670852
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
go.mod
|
||||
go.sum
|
||||
mastodon-group-bot
|
||||
*.db
|
||||
|
30
README.md
30
README.md
@ -1,11 +1,14 @@
|
||||
# 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",
|
||||
@ -20,17 +23,30 @@ The bot is configured in a JSON file that looks like this:
|
||||
```
|
||||
|
||||
# Building
|
||||
|
||||
```
|
||||
go mod init mastodon-group-bot
|
||||
|
||||
go mod tidy
|
||||
|
||||
go build
|
||||
```
|
||||
|
||||
# Usage
|
||||
# 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
|
||||
|
18
services/openrc/mastodon-group-bot
Normal file
18
services/openrc/mastodon-group-bot
Normal file
@ -0,0 +1,18 @@
|
||||
#!/sbin/openrc-run
|
||||
name=$RC_SVCNAME
|
||||
command="/usr/bin/$name"
|
||||
command_args="-config"
|
||||
cfgfile="/etc/$name.json"
|
||||
pidfile="/run/$name.pid"
|
||||
user="nobody:nobody"
|
||||
description="Mastodon group bot which reposts toots"
|
||||
start() {
|
||||
ebegin "Starting $name"
|
||||
start-stop-daemon -bm -S -u $user -p $pidfile -x $command -- $command_args $cfgfile
|
||||
eend $?
|
||||
}
|
||||
stop() {
|
||||
ebegin "Stopping $name"
|
||||
start-stop-daemon -K -p $pidfile
|
||||
eend $?
|
||||
}
|
12
services/systemd/mastodon-group-bot.service
Normal file
12
services/systemd/mastodon-group-bot.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Mastodon group bot which reposts toots
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=nobody
|
||||
ExecStart=/usr/bin/mastodon-group-bot -config /etc/mastodon-group-bot.json
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user