NTV (Italo train) Promo Code Telegram bot
4.7K
This repository contains the code for a docker-compose deployable Telegram bot, which uses the Telegram Python API and this Twitter Javascript API scraper; the bot itself will just look for the latest promo code related tweet among the ones on the first page of the ItaloTreno account, by scraping it every ten minutes.
Also, the Docker Images for ARMv7, AARCH64 and x86_X64 platforms are automatically built from this repository, and available from Docker Hub
The Dockerfile is written to allow cross-architecture builds, using QEMU's user-static package: to build the image on x86 for another platform do the following:
qemu-user-static if you need to run the container on an architecture different from the local one;cp $(which qemu-aarch64-static) .;docker build -t myregistry/ntvpromo:arm64 ..If you want to use a target architecture different from ARM 64 bit, just change the Dockerfile according to the needed qemu-static-* binary file, and copy it into the repo directory as shown above. Also, remember to specify the correct base image at the beginning of the Dockerfile.
The Python code assumes the existence of the folder .secret in the repository's root directory; inside it, two file should be placed, as in the following structure example:
.secrets
├── AUTH_USER.secret
└── TOKEN.secret
The .secret text files should contain the following data:
NOTE: the code provided in this repository will not work without such secret files!
You may first choose the correct image for the host CPU architecture; change the image: property using either the amd64, arm64 or the arm32 tag. The default is amd64.
Open the repository's root directory in a terminal and issue the following command:
docker-compose up -d
Open the repository's root directory in a terminal and issue the following command:
python3 -m venv app/.venv
source app/.venv/bin/activate
pip3 install -U pip
pip3 install -U -r app/requirements.txt
export TZ="Europe/Rome"
mkdir data
python3 app/main.py
The bot should start logging some info.
Content type
Image
Digest
sha256:025948977…
Size
25.4 MB
Last updated
6 months ago
docker pull procsiab/ntvpromo