Telegram chat and inline bot for our community https://t.me/mental_illness_center_bot
Go to file
2024-10-19 12:31:17 +02:00
bot Initial commit 2024-10-19 12:00:35 +02:00
cfg Initial commit 2024-10-19 12:00:35 +02:00
core Initial commit 2024-10-19 12:00:35 +02:00
external Initial commit 2024-10-19 12:00:35 +02:00
migrations Initial commit 2024-10-19 12:00:35 +02:00
repo Initial commit 2024-10-19 12:00:35 +02:00
utils Initial commit 2024-10-19 12:00:35 +02:00
config.ts Migrations config fix 2024-10-19 12:14:06 +02:00
deno.json Initial commit 2024-10-19 12:00:35 +02:00
deno.lock Initial commit 2024-10-19 12:00:35 +02:00
DEV-NOTES.md Dev notes updated 2024-10-19 12:31:17 +02:00
LICENSE Initial commit 2024-10-13 18:27:42 +00:00
main.ts Initial commit 2024-10-19 12:00:35 +02:00
README.md Initial commit 2024-10-19 12:00:35 +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

{
    // 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",
    // BOT_TOKEN env variable has more priority
    // that the config value
    "bot_token": "<your_token>"
}

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