55 lines
2.8 KiB
Markdown
55 lines
2.8 KiB
Markdown
# Fediverse Admin Bot
|
|
|
|
This is a simple bot designed for misskey (and its forks) to redirect mentions and messages to an unmonitored `@admin` account
|
|
to a monitored account.
|
|
|
|
For example, this bot is running under `@admin@fedi.transgender.ing` and redirects all mentions and messages to `@nex@fedi.transgender.ing`, and includes
|
|
a link to the relevant matrix room. You can see the exact reply [in copy.txt](./copy.txt).
|
|
|
|
This bot requires an API key, and the ability to see notifications, create notes, and add reactions to notes. When bot.py is run, it will loop indefinitely,
|
|
fetching new notifications and processing every minute (configurable).
|
|
|
|
## Installation
|
|
|
|
Simply clone the repository, or grab the latest release. Then, create a virtualenv, and install the requirements from requirements.txt.
|
|
This bot was created with Python 3.12, however should be compatible with any version of Python 3.8 or above. It doesn't use any fancy syntax, at least.
|
|
|
|
### config.ini
|
|
|
|
Before you start, you'll need a `config.ini` in your working directory. This file should look like this:
|
|
|
|
```ini
|
|
[domain.example] # the domain of the instance you're running on
|
|
api_key = your_api_key
|
|
sleep_time = 60 # how long to wait between loops, in seconds. Default is 1 minute, if omitted.
|
|
limit = 100 # how many notifications to fetch at once.
|
|
# If your admin account is getting an absurd amount of traffic, you may need to raise this to ensure that all notifications are processed.
|
|
```
|
|
|
|
### `.lastfetch`
|
|
|
|
You need to make sure that the bot can read+write to the `./.lastfetch` - this file contains a string, which is the ID of the last fetched notification.
|
|
Deleting this will cause the bot to reprocess the last `:limit:` notifications, which may result in double-posting.
|
|
This file does not have to exist on startup, it will be created.
|
|
Do not edit this file, unless you want to manually replace what the last fetched notification was.
|
|
|
|
If you have an ID you would like to use as the epoch, you can either manually write it to that file, or set it as the `$EPOCH_ID` environment variable.
|
|
|
|
### `bot.log`
|
|
|
|
The bot will automatically log all decisions it makes, timestamped, with a reason, to a file called `bot.log`. This file will be created if it does not exist.
|
|
|
|
**The log file does not automatically rotate.** If you want to keep logs for a long time, you will need to manually rotate them.
|
|
The log file is also not overwritten on startup, it is automatically appended to. It is more of a black-box thing than a debugging tool.
|
|
|
|
#### Setting the log level
|
|
|
|
By default, the log level is set to `INFO`. If you want to change this, you can set the `LOGLEVEL` environment variable to one of the following:
|
|
|
|
* `DEBUG`
|
|
* `INFO`
|
|
* `WARNING`
|
|
* `ERROR`
|
|
* `CRITICAL`
|
|
|
|
Debug is the most verbose, critical is only for the most severe errors.
|