|
|
|
# Misskey BlockBot (WIP)
|
|
|
|
|
|
|
|
Misskey Blockbot is a dead-ass simple and "customizable" block reporting bot for Misskey.
|
|
|
|
|
|
|
|
## About
|
|
|
|
|
|
|
|
This bot's main purpose is to post a periodic report to an specific user about the people who have blocked him/her.
|
|
|
|
Mind you, this is a WIP so there's still work to do. For the time being, it'll work for the instance admin.
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
To set up this bot you need to have `python3`, `pip` and `git` installed in your environment. Also, you need the access
|
|
|
|
token for the bot account in your Misskey instance. And last but not least, you need access to the server and database
|
|
|
|
credentials. tl;dr, you need to be the instance and server owner ¯\_(ツ)_/¯
|
|
|
|
|
|
|
|
* First, install Python, Git, pip, etc.
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo apt get update
|
|
|
|
sudo apt install git python3 pip
|
|
|
|
```
|
|
|
|
|
|
|
|
* Clone the repository, copy or rename the `example.config.json` to `config.json`, and read the code, **please**. Try to
|
|
|
|
understand it, it's simple.
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone 'https://git.cachapa.xyz/captain_arepa/misskey-blockbot.git'
|
|
|
|
cd misskey-blockbot/
|
|
|
|
cp example.config.json config.json
|
|
|
|
```
|
|
|
|
|
|
|
|
* Modify the `config.json` with the credentials and data necessary to make to bot work.
|
|
|
|
* Set up the virtual environment for the bot.
|
|
|
|
|
|
|
|
```
|
|
|
|
python -m venv venv
|
|
|
|
source venv/bin/activate
|
|
|
|
pip install --upgrade pip
|
|
|
|
pip install -r requirements.txt
|
|
|
|
deactivate
|
|
|
|
```
|
|
|
|
* Make the `run.sh` executable, and the run it with the desire frequency.
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo chmod +x run.sh
|
|
|
|
./run.sh DAILY|WEEKLY|MONTHLY
|
|
|
|
```
|
|
|
|
|
|
|
|
* Conversely, you could clone the repository to your local machine and run it from there, or deploy via rsync it to your
|
|
|
|
remote
|
|
|
|
server using the `deploy.sh` script. For this option I highly recommend to set up a custom host configuration in
|
|
|
|
your `.ssh` folder.
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo chmod +d deploy.sh
|
|
|
|
./deploy.sh <your-server-username> <your-server-host> <target-directory>
|
|
|
|
```
|
|
|
|
|
|
|
|
## How to use it
|
|
|
|
|
|
|
|
First, you have to set a few values in the config file. They're pretty self explanatory if you read
|
|
|
|
the `example.config.json`
|
|
|
|
|
|
|
|
* `mk_username`: this is the user whose blocks will be fetched (i.e. the instance admin in this case).
|
|
|
|
* `mk_token`: this is the bot's account generated token.
|
|
|
|
* The message's `visibility` follows Misskey's convention:
|
|
|
|
* `public`: posts on the instance's public timeline.
|
|
|
|
* `home`: posts only to your home timeline.
|
|
|
|
* `followers`: posts will be only visible to the bot's followers.
|
|
|
|
* `local_only`: if true, the bot's posts won't federate to other instances.
|
|
|
|
* `no_block_text`: in case you want to brag about being a block virgin.
|
|
|
|
* `block_count_text`: in case you want to brag about how many people have blocked you.
|
|
|
|
* `last_block_text`: in case you want to snitch on the last person who blocked you.
|
|
|
|
* `use_ssh`: set to `true` if you will run this bot from your local machine, otherwise set it to `false`.
|
|
|
|
* In case you're running the bot from your local machine, set the tunnel's `address` to your remote server IP.
|
|
|
|
* In case you're using remote IP address for the database (i.e. a different server), and/or are using custom ports,
|
|
|
|
change them accordingly.
|
|
|
|
|
|
|
|
In order to run the bot, you can set the frequency using `crontab` or whatever service you use. I personally set up
|
|
|
|
crontab the following way:
|
|
|
|
|
|
|
|
```
|
|
|
|
05 00 1 * * /absolute/path/to/run.sh MONTHLY >> "/absolute/path/to/log.txt" 2>&1 #this will also run every 1st day of every month at 00:05 UTC
|
|
|
|
50 23 * * 0 /absolute/path/to/run.sh WEEKLY >> "/absolute/path/to/log.txt" 2>&1 #this will run every Sunday at 23:50 UTC
|
|
|
|
55 23 * * * /absolute/path/to/run.sh DAILY >> "/absolute/path/to/log.txt" 2>&1 #this will run every day at 23:55 UTC
|
|
|
|
```
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
|
|
|
|
* Lots of stuff, this is a WIP, I'll come up with stuff later, I'm tired, lmao.
|