Skip to content

This is a new, Rusty, iteration of a telegram bot to query definitions of words from the Spanish Language Dictionary. The original versión was developed in Python and is at studentenherz/dleraebot.

License

Notifications You must be signed in to change notification settings

studentenherz/dlebot

Repository files navigation

@dlebot gets Rusty

This is a new, rusty, iteration of studentenherz/dleraebot that was originally developed in Python. For some time now I've been meaning to add some new features to the bot, but, as the time when I developed de bot was falling further into the past, the implementation and configuration details became almost arcane technology.

With over a year of experience since the last commit I'm very confident that I'm able to rewrite the project in Python taking better practices into account, making it easier to maintain and add features. However, instead of doing that, I'm going to develop this other version of th bot using Rust for two main reasons:

  • Rust is faster than Python (although in this case I'm not sure it will make a noticeable difference);
  • I want to. I want to learn Rust with a project and this will be it.

I guess that, as this will be a learning project, in the end I'll get something that in a year from now I'll see in the same way I see the previous version.

Setup

  1. Clone this repo.

    git clone https://github.com/studentenherz/dlebot.git
  2. Set up environment variables. See .env-sample for the list of required and optional environment variables. You can set them or use a .env file based on .env-sample.

    There you can set up a custom API url if you are using a local instance of telegram-bot-api; there is no need for this, but the Telegram BOT API servers are located in Europe, depending on where you are running the bot, it might be better to run your own instance.

  3. Start the database

    docker compose up -d
  4. Run the migrations, read here in order to see more detail.

    cd migration
    cargo run
  5. Populate the database from a .csv with the columns in the order lemma, definition, conjugation (or specify the order in the command, see here).

    cat dle.csv | psql $DATABASE_URL -c 'COPY dle FROM STDIN (FORMAT csv)'
  6. For development run the bot with

    cargo run

    For production use the --release option.

  7. To install in systemd run the script install.sh from the root of the repo. Optionally, if you have a local instance of the BOT API you can install it to systemd with install-telegram-bot-api.sh

See a live version of the bot in Telegram @dlebot.

About

This is a new, Rusty, iteration of a telegram bot to query definitions of words from the Spanish Language Dictionary. The original versión was developed in Python and is at studentenherz/dleraebot.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published