almost fill readme and add samples

This commit is contained in:
2022-09-09 22:59:49 +06:00
parent f411b757fd
commit 1446caaade
5 changed files with 184 additions and 216 deletions

5
sample/.env Normal file
View File

@@ -0,0 +1,5 @@
DATA_PATH=.
PG_USER=test_user
PG_PASSWORD=test_password
PG_DB=test_db

138
sample/config.json Normal file
View File

@@ -0,0 +1,138 @@
{
"database": {
"url": "jdbc:postgresql://postgres/test_db",
"username": "test_user",
"password": "test_password",
"driver": "org.postgresql.Driver"
},
"botToken": "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi",
"plugins": [
"dev.inmo.plaguposter.posts.Plugin",
"dev.inmo.plaguposter.posts.registrar.Plugin",
"dev.inmo.plaguposter.ratings.Plugin",
"dev.inmo.plaguposter.ratings.source.Plugin",
"dev.inmo.plaguposter.ratings.selector.Plugin",
"dev.inmo.plaguposter.triggers.selector_with_timer.Plugin",
"dev.inmo.plaguposter.ratings.gc.Plugin",
"dev.inmo.plaguposter.inlines.Plugin",
"dev.inmo.plaguposter.triggers.command.Plugin"
],
"posts": {
"chats": {
"targetChat": -1001234567890,
"cacheChat": -1001234567890,
"sourceChat": -1001234567890
},
"autoRemoveMessages": true
},
"ratingsPolls": {
"variants": {
"Круть": 2,
"Ок": 1,
"Не ок": -1,
"Совсем не ок": -2,
"Посмотреть результаты": 0
},
"autoAttach": true,
"ratingOfferText": "How do you like it?"
},
"selector": {
"items": [
{
"time": {
"from": "23:00",
"to": "23:59"
},
"rating": {
"min": -1.0,
"max": 2.0,
"prefer": "max",
"otherwise": {
"rating": {
"min": 2.0,
"prefer": "min",
"postAge": 86400
}
},
"postAge": 86400
}
},
{
"time": {
"from": "00:00",
"to": "06:59"
},
"rating": {
"min": -1.0,
"max": 2.0,
"prefer": "max",
"otherwise": {
"rating": {
"min": 2.0,
"prefer": "min",
"postAge": 86400
}
},
"postAge": 86400
}
},
{
"time": {
"from": "07:00",
"to": "12:00"
},
"rating": {
"min": 1.0,
"prefer": "min",
"otherwise": {
"rating": {
"max": 1.0,
"prefer": "max",
"postAge": 86400
}
},
"postAge": 86400
}
},
{
"time": {
"from": "12:00",
"to": "16:00"
},
"rating": {
"min": 2.0,
"prefer": "min",
"otherwise": {
"rating": {
"max": 2.0,
"prefer": "max",
"postAge": 86400
}
},
"postAge": 86400
}
},
{
"time": {
"from": "16:00",
"to": "23:00"
},
"rating": {
"prefer": "max",
"postAge": 86400
}
}
]
},
"timer_trigger": {
"krontab": "0 30 */5 * *"
},
"gc": {
"autoclear": {
"rating": -1,
"autoClearKrontab": "0 0 0 * *",
"skipPostAge": 86400
},
"immediateDrop": -2
}
}

23
sample/docker-compose.yml Normal file
View File

@@ -0,0 +1,23 @@
version: "3.4"
services:
plaguposter_postgres:
image: postgres
container_name: "plaguposter_postgres"
restart: "unless-stopped"
environment:
POSTGRES_USER: "${PG_USER}"
POSTGRES_PASSWORD: "${PG_PASSWORD}"
POSTGRES_DB: "${PG_DB}"
volumes:
- "${DATA_PATH}/db/:/var/lib/postgresql/"
plaguposter:
image: insanusmokrassar/plaguposter
container_name: "plaguposter"
restart: "unless-stopped"
volumes:
- "${DATA_PATH}/config.json:/config.json"
links:
- "plaguposter_postgres:postgres"
depends_on:
- "plaguposter_postgres"