This is a simple Telegram bot designed to help users learn new English words. It is written using Aiogram 3 and utilizes Postgres as a database. In addition, for every saved word, it provides an example of usage, leveraging the WordsAPI.
The project was written in Python 3.10. To run it, you need to install PostgreSQL. Alternatively, you can use Docker to lift a container with the database.
Additionally, you need to obtain the tokens:
- Clone this reprository.
git clone https://github.com/kkonstantin182/tg-language-bot.git
- Create .env file and specify the tokens and credentials for the database (see the .env.example):
- BOT_TOKEN: Telegram bot authentication token.
- WORDS_API_TOKEN: API key for the WordsAPI service.
- DB_HOST: Hostname or IP address of the PostgreSQL server.
- DB_USER: Username for PostgreSQL database authentication
- DB_PASSWORD: Password for PostgreSQL database authentication.
- DATABASE: Name of the PostgreSQL database.
- If you are using Docker, lift the container with the database in the project folder (or start the Postgres):
docker compose up
-
Create a virtual environment and install dependencies from requirements.txt.
-
Run the bot:
python app.py
- Once started, type in Telegram:
/start
To see the description of available commands, type in Telegram:
/help
(!) Keep in mind that the first (original word) should be in English, otherwise it won't be possible to get the examples from WordsAPI.
- Aiogram 3 - Asynchronous framework for Telegram Bot API.
- Asyncpg - Database interface library for PostgreSQL for use with Python’s asyncio framework.
More features may be added :)