get lunch menus sent to your e-mail/groupchat
Clone the repo:
$ git clone https://github.com/helb/jidlobot.git
$ cd jidlobot
Create a virtual environment:
$ virtualenv -p `which python3` .venv
$ source .venv/bin/activate
Install dependencies:
$ pip install -r requirements.txt
Copy jidlobot.yml.example
to jidlobot.yml
and set:
HTTP_TIMEOUT
to the number of seconds you would want to wait for each URLURLS
β list of urls, supported sites are:menicka.cz
zomato.com
(they have some scraping protection in place, make sure to haveZOMATO_UA
set in your config)
BACKENDS
β where to send the message:mail
mattermost
hipchat
rocketchat
console
(just prints the output).
If using mail
backend:
MAIL_FROM
β Sender e-mail addressMAIL_TO
β List of recipientsMAIL_SERVER
(defaultlocalhost
) andMAIL_PORT
(default25
) β MTA (SMTP server) addressMAIL_USER
(default same asMAIL_FROM
) andMAIL_PW
β SMTP server credentials (not used ifMAIL_PW
is not set)MAIL_STARTTLS
(defaultTrue
) β Use STARTTLS connection method- If your local MTA works well, set
MAIL_FROM
andMAIL_TO
only
If using mattermost
backend:
MATTERMOST_WEBHOOK
β URL for webhook,https://mattermost.β¦/hooks/β¦
MATTERMOST_CHANNEL
β channel nameMATTERMOST_USERNAME
β bot's username
If using hipchat
backend:
HIPCHAT_URL
β URL of your HipChat server, with trailing slashHIPCHAT_ROOM
β room IDHIPCHAT_TOKEN
β room notification tokenHIPCHAT_COLOR
β message background, valid values areyellow
,green
,red
,purple
,gray
, andrandom
.
If using rocketchat
backend:
ROCKETCHAT_WEBHOOK
β URL for webhook,https://rocketchat.β¦/hooks/β¦
ROCKETCHAT_CHANNEL
β channel name
More than one backend can be used at the same time, eg.:
BACKENDS:
- mattermost
- mail
- console
$ ./jidlobot.py
Create a cron job if everything works.
Example script for running from cron:
#!/bin/bash
set -e
cd /path/to/jidlobot
source .venv/bin/activate
python jidlobot.py
Example crontab entry (runs Monday to Friday at 10:58):
58 10 * * 1-5 /path/to/jidlobot.sh