Telegram bot for translation in Python using aiogram, reverso-context-api, PostgreSQL and Google Translator
Telegram bot gets source and target languages from user and stores it in database. User can enter word/phrase and get translation of that.
The PostgreSQL database is used for data storage.
The bot, receiving a request from the user, processes it using the aiogram library, which interacts with the Telegram bot API.
- Setting source and target language
- Translate words/phrases in under of Reverso Context
- Sharing a link to Google Translator if no words/phrases are found on the given dictionary
- Provides some statistics to the admin user
- Command /admin_on checkes if user is admin (admin is set in .env file)
- Then user gets list of others commands to see a statistic
- Python3.8
- PostgreSQL
- aiogram 2.20
- reverso-context-api 0.5
- All packages are located in requirements.txt
- Environmental variables are located in .env (you must change example.env file)
- Download project locally
- Run following to activate a virtualenv in your terminal:
python3 -m venv env
. env/bin/activate
- Run:
pip install -r requirements.txt
to install all necessary packages - Run:
sudo service postgresql start
to launch a database - Run:
bash launch_bot.sh
to launch a bot
- Download project locally
- Create venv and activate that
- Run:
pip install -r requirements.txt
to install all necessary packages - Run:
sudo service postgresql start
to launch a database - Run:
python app.py
to launch a bot
- Aiogram library works well on Linux OS, but may crash on other operating systems
- Python's and pip's versions can differ from the same in that project
Project is in progress
- Adding new languages
- Adding feature for an admin to get more statistic information
- Replace polling with webhook