mirror of
https://github.com/InsanusMokrassar/BooruGrabberTelegramBot.git
synced 2024-11-23 08:28:42 +00:00
Update README.md
This commit is contained in:
parent
034f5fb7ca
commit
96ec7bbb0c
109
README.md
109
README.md
@ -1,33 +1,104 @@
|
|||||||
# Telegram Bot Template
|
# BooruGrabberTelegramBot
|
||||||
|
|
||||||
That is template for telegram bots based on next stack of technologies:
|
Bot for booru-boards grabbing. It uses [imageboard-api](https://github.com/Kodehawa/imageboard-api) for requests to boards and support next boards as well as `imageboard-api`:
|
||||||
|
|
||||||
* [Kotlin Coroutines](https://github.com/Kotlin/kotlinx.coroutines)
|
* Rule34
|
||||||
* [Kotlin Serialization](https://github.com/Kotlin/kotlinx.serialization)
|
* e621
|
||||||
* [Telegram Bot API Library](https://github.com/InsanusMokrassar/TelegramBotAPI) (by default everything is included like
|
* Konachan
|
||||||
it was described [here](https://github.com/InsanusMokrassar/TelegramBotAPI#ok-where-should-i-start))
|
* Yande.re
|
||||||
|
* Danbooru
|
||||||
|
* Safebooru
|
||||||
|
* Gelbooru
|
||||||
|
* e926
|
||||||
|
|
||||||
## Default
|
Sample bot presented here: [@booru_grabber_bot](https://t.me/booru_grabber_bot)
|
||||||
|
|
||||||
Since you have used this repo as a template you can copy file `example.config.json` as `local.config.json`, put there your bot token and simply run command `./gradlew run --args="local.config.json"`. As an output you will get your bot information like:
|
## Available commands
|
||||||
|
|
||||||
|
Bot have two helping commands: `/start` and `/help`. These commands will return help for bot `/request`/`/enable` commands:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ExtendedBot(id=ChatId(chatId=1234567890), username=Username(username=@username_of_your_bot), firstName=Name of bot, lastName=, canJoinGroups=(some boolean), canReadAllGroupMessages=(some boolean), supportsInlineQueries=(some boolean))
|
Usage: enable [OPTIONS] QUERY...
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-n INT Amount of pictures to grab each trigger
|
||||||
|
time
|
||||||
|
-k, --krontab TEXT... Krontab in format * * * * *. See
|
||||||
|
https://bookstack.inmo.dev/books/krontab/page/string-format
|
||||||
|
-b, --board VALUE Board type. Possible values: r34, e621,
|
||||||
|
konachan, yandere, danbooru, safebooru,
|
||||||
|
gelbooru, e926
|
||||||
|
-g, --gallery Effective only when count passed > 1. Will
|
||||||
|
send chosen images as gallery instead of
|
||||||
|
separated images
|
||||||
|
-r, --rating [safe|general|questionable|sensitive|explicit]
|
||||||
|
-a, --attach_urls
|
||||||
|
-h, --help Show this message and exit
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
QUERY Your query to booru. Use syntax "-- -sometag" to add excluding of
|
||||||
|
some tag in query
|
||||||
```
|
```
|
||||||
|
|
||||||
### Docker
|
As said previously, there are `/request` and `/enable`
|
||||||
|
|
||||||
In this template there is template-like [docker-compose](docker-compose.yml) and [docker](sample.Dockerfile) files. Besides,
|
### Request parameters
|
||||||
there is [Makefile](Makefile) and you may use something like `make buildAndStartCompose` to start your bot.
|
|
||||||
|
|
||||||
It is important to replace `"TOKEN"` in [Dockerfile](sample.Dockerfile) or remove and add some config as a volume.
|
I will omit obvious parameters like `-n`.
|
||||||
|
|
||||||
## What next?
|
* `-b`/`--board` - select which board to use
|
||||||
|
* `-n` (optional, default 1, max 10)
|
||||||
|
* `-k`/`--krontab` (optional) - use [krontab](https://bookstack.inmo.dev/books/krontab/page/string-format)-string for setting up request from time to time. Unfortunatelly, **currently supported only main five settings: seconds, minutes, hours, days and months**
|
||||||
|
* `-g`/`--gallery` (optional) - flag indicates that in case you passed `-n` more than 1 messages should be sent as media group
|
||||||
|
* `-r`/`--rating` (optional) - rating of images in requests
|
||||||
|
* `-a`/`--attach_urls` (optional) - will force bot to attach url of image to the sent images
|
||||||
|
|
||||||
There are several ways to continue:
|
Besides, after all parameters you should add query for the board like `rem_(re:zero)`:
|
||||||
|
|
||||||
* [Tutorials](https://bookstack.inmo.dev/books/telegrambotapi)
|
```
|
||||||
* [Github readme](https://github.com/InsanusMokrassar/TelegramBotAPI)
|
/request -n 3 -a -b safebooru -g rem_(re:zero)
|
||||||
|
```
|
||||||
|
|
||||||
In other words, this template (and [TelegramBotAPI library](https://github.com/InsanusMokrassar/TelegramBotAPI)) does
|
If you want to use negative query parameters, you must escape them with `--` before parameter:
|
||||||
not limit you on choosing of way to continue 😊
|
|
||||||
|
`-- -1girl` (exclude posts with `1girl` tag)
|
||||||
|
|
||||||
|
Bot remember which posts it already has sent to the chat. So, there should not be repetitions in the sent images
|
||||||
|
|
||||||
|
### Samples
|
||||||
|
|
||||||
|
All the samples will use query `rem_(re:zero) -- -1girl` (in fact it is query `rem_(re:zero) -1girl`) and `-r safe` just to make request suitable for work.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Sample from above to request 3 photos in gallery mode from safebooru with urls attaching:
|
||||||
|
|
||||||
|
```
|
||||||
|
/request -n 3 -a -b safebooru -g rem_(re:zero) -- -1girl
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Same sample as above, but with requests each day at 22:00 UTC
|
||||||
|
|
||||||
|
```
|
||||||
|
/enable -k 0 0 22 * * -n 3 -a -b safebooru -g rem_(re:zero) -- -1girl
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Same sample as above, but with requests each day at 22:00 UTC
|
||||||
|
|
||||||
|
```
|
||||||
|
/enable -k 0 0 22 * * -n 3 -a -b safebooru -g rem_(re:zero) -- -1girl
|
||||||
|
```
|
||||||
|
|
||||||
|
Will enable autorequests of images using [krontab](https://bookstack.inmo.dev/books/krontab/page/string-format) and other parameters.
|
||||||
|
|
||||||
|
Sample:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/enable -n 3 -k 0 0 18 * * -b safebooru -g 1girl gradient
|
||||||
|
```
|
||||||
|
|
||||||
|
You may use the same syntax with just replacing of `/enable` by `/request`
|
||||||
|
Loading…
Reference in New Issue
Block a user