Skip to content

Telegram bot to query definitions of words in Spanish using RAE's dictionary.

Notifications You must be signed in to change notification settings

studentenherz/dleraebot

Repository files navigation

Bot to query spanish definitions using RAE

Using the bot as a client

You can inspect a live version of the code in the telegram bot @dleraebot.

Setting up a local instance

Clone the repository

$ git clone https://github.com/studentenherz/dleraebot.git

Install required dependencies

$ pip install -r requirements.txt

Create your configuration file

Make a copy of the file:

credentials.py.sample

And name it:

credentials.py

Edit your bot token in the file. If you don't have one, you can get it using @BotFather in Telegram.

Running the bot

Here the bot is set to use webhooks, with an aiohttp server through gunicorn

$ gunicorn app:app -k aiohttp.worker.GunicornWebWorker -b <host>:<port>

See this to learn how to set up the webserver with nginx + gunicorn.

Then, for database update and daily boradcast of the Word Of The Day, schedule the cronjob.py in the crontab:

$ crontab -e 

should have two lines like these:

* * * * * path/to/your/env/python /path/to/the/code/cronjob.py # update database every minute
0 12 * * * path/to/your/env/python /path/to/the/code/cronjob.py --broadcast # broadcast every day at 12:00

About

Telegram bot to query definitions of words in Spanish using RAE's dictionary.

Topics

Resources

Stars

Watchers

Forks

Languages