Skip to content

darthunix/bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bot

A telegram bot that persists the dialogs into the PostgreSQL database. The code is written with async Rust (tokio runtime) and relies on teloxide (for telegram bot API) and deadpool (for PostgreSQL communication).

PostgreSQL schema

The schema is versioned with Pyrseas and stored in the db.yaml file. To generate the SQL file from the YAML file, run:

createdb bot
yamltodb bot bot-core/src/db.yaml > migration.sql
psql -f migration.sql bot

Build

cargo build --release

Run

First export your telegram bot token:

export TELOXIDE_TOKEN=...

Then run the bot:

RUST_LOG="debug" PG_USER=$USER PG_POOL_CAPACITY=2 ./target/release/bot

You can configure the PostgreSQL connection settings with the environment variables listed in the config_from_env() function.

Releases

No releases published

Packages

No packages published

Languages