/heig-bot

Unofficial telegram bot for interaction with HEIG-VD GAPS website

Primary LanguagePython

HEIG bot

Documentation Status

Telegram bot for check gradle in GAPS (HEIG-VD's platform for gradle). This can also check regularly if a user have new gradle and send message if.

Link

DISCLAIMER

Your password is stored in clear. This is necessary to connect to GAPS website. Using someone else's instance is not safe. Install your own instance If the computer running "heig-bot" was compromised, passwords would also be compromised

Depends

  • python-telegram-bot
  • beautifulsoup4
  • ics
  • requests
  • dask-sphinx-theme (for generate documentation)
  • sphinx (for generate documentation)

On Debian buster and earlier

pip3 install python-telegram-bot beautifulsoup4 ics

# if you need generate documentation
apt install python3-sphinx-rtd-theme python3-sphinx

and python3-arrow

On Debian bullseye/sid

apt install python3-python-telegram-bot python3-bs4 python3-arrow
pip3 install ics

# if you need generate documentation
apt install python3-sphinx-rtd-theme python3-sphinx

On Arch Linux

sudo pacman -S python-pip python-telegram-bot python-beautifulsoup4
sudo pip install ics

# if you need generate documentation
sudo pacman -S python-sphinx
sudo pip install sphinx_rtd_theme

and python3-arrow

Installation

cd /opt/
git clone https://github.com/g-roch/heig-bot.git -b stable
cp heig-bot/heig-bot.json.sample heig-bot/heig-bot.json
mkdir -p /var/heig-bot/ # set right for script can write

Create bot

You need create a telegram bot with BotFather, and copy the bot key in heig-bot.json. (value of bot_token)

Admin/Logs configuration

heig-bot can have admins, you can copy telegram userid (it's a number) to heig-bot.json in admin in group group.

heig-bot can send a message when he start, you can copy telegram userid (it's a number) to heig-bot.json in log in group group.

You can see your telegram userid when you send /help to the heig-bot. The bot can start without admin, but you need remove "" from admin in group group and log in group in heig-bot.json, for empty array.

Start bot manually

cd /opt/heig-bot && ./bot.py

Start bot with Docker

docker build -t heig-bot .
docker run --rm -ti heig-bot

Start bot with docker-compose

docker-compose up

Auto update

add to cron :

*/5 * * * * cd /opt/heig-bot && ./cron.py

Generate docs

Install deps for generate docs (see above).

cd docs
make html

Publish new version