Telegram chat and inline bot for our community https://t.me/mental_illness_center_bot
bot | ||
cfg | ||
core | ||
external | ||
migrations | ||
repo | ||
utils | ||
.dockerignore | ||
.gitignore | ||
config.ts | ||
deno.json | ||
deno.lock | ||
DEV-NOTES.md | ||
dev.docker-compose.yml | ||
dev.Dockerfile | ||
docker-compose.yml | ||
Dockerfile | ||
LICENSE | ||
main.ts | ||
README.md |
mic-bot
Telegram chat and inline bot for our community https://t.me/mental_illness_center_bot
Features
Captcha
When new user starts the bot it sends him a captcha. After passing the captcha user can get the chat invite
Safebooru image search
To search images via safebooru just type in your message prompt
@mental_illness_center_bot safebooru <tags>
and it will find images for you.
TODO:
- Safebooru images lazy loading
- Minecraft server intergration
- Referal system
- Safebooru ChatGPT text to tags
Config
File config
Before running MIC create file ./config.json
that contains
{
// BOT_TOKEN env variable has more priority
// that the config value
"bot_token": "<your_token>"
// to run in Docker set the value to
// "/run/secrets/db_password"
// If wasn't set -- POSTGRES_PASSWORD env
// variable will be used instead
"db_password_file": "~/.secrets/mic",
// other optional db config parameters
// Defaults can be seen/changed inside the config.ts file
"db_user": string,
"db_name": string,
"db_port": number,
// if you are running under docker -- set host to postgres
"db_host": string,
"db_tls": boolean,
}
Environment variables
POSTGRESS_PASSWORD
DB Password. If Config file propertydb_password_file
has been set -- it will be used insteadBOT_TOKEN
Telegram bot token. Has bigger priority than the config propertyMIC_CONFIG_PATH
Specifies the path to a MIC config file../config.json
by defaultMIC_APPLY_MIGRATIONS
(y/N) // Set it to "y" before running the MIC for the first time to apply DB migrations. Gets reseted to "n" automatically so migrations are applied onceMIC_DROP_DB
(y/N) // I WILL RAPE U IF U USE IT ON A PROD DB. ONLY FOR DEVELOPMENT!!! Gets reseted to "n" automatically for security reasons
More advanced parameters can be configured at config.ts
.
Running
Warning
Read the Config section before running. App won't start without a valid configuration!
Docker
# Create directories required by the app
mkdir .secrets postgres_data
# Set the DB password
nvim .secrets/db_password.txt
# Classical docker commands
docker compose build
docker compose up
Host
Before running the bot on host -- setup
mkdir bin
# With compilation
deno compile -o ./bin/mic ./main.ts
./bin/mic
# Just run it
deno run ./main.ts
# Dev run with autorestart
deno run ./main.ts