Telegram chat and inline bot for our community https://t.me/mental_illness_center_bot
Go to file
2024-10-25 20:10:48 +02:00
bot Fixes I guess? 2024-10-25 19:35:12 +02:00
cfg Infra update 2024-10-24 16:39:42 +02:00
core Fixes I guess? 2024-10-25 19:35:12 +02:00
external Initial commit 2024-10-19 12:00:35 +02:00
migrations Minor changes 2024-10-23 18:09:10 +02:00
repo drop DB functionality added 2024-10-25 20:10:48 +02:00
utils Initial commit 2024-10-19 12:00:35 +02:00
.dockerignore Infra update 2024-10-24 16:39:42 +02:00
.gitignore Infra update 2024-10-24 16:39:42 +02:00
config.ts drop DB functionality added 2024-10-25 20:10:48 +02:00
deno.json Initial commit 2024-10-19 12:00:35 +02:00
deno.lock Fixes I guess? 2024-10-25 19:35:12 +02:00
DEV-NOTES.md Dev notes updated 2024-10-19 12:31:17 +02:00
dev.docker-compose.yml Infra update 2024-10-24 16:39:42 +02:00
dev.Dockerfile Infra update 2024-10-24 16:39:42 +02:00
docker-compose.yml Infra update 2024-10-24 16:39:42 +02:00
Dockerfile Fixes 2024-10-24 10:35:13 +02:00
LICENSE Initial commit 2024-10-13 18:27:42 +00:00
main.ts Fixes 2024-10-24 10:35:13 +02:00
README.md Infra update 2024-10-24 16:39:42 +02:00

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

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 property db_password_file has been set -- it will be used instead
  • BOT_TOKEN Telegram bot token. Has bigger priority than the config property
  • MIC_CONFIG_PATH Specifies the path to a MIC config file. ./config.json by default
  • MIC_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 once
  • MIC_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