This is the code for my Telegram Bot with which you can play the game Black Jack. You can find the hosted version of it here: https://telegram.me/BlackJackBot
This project is really easy to set up. No matter which of the following ways you'll use, you'll always need a config file.
To create one, simply copy the existing config.sample.py
file and name it config.py
. Enter your bot token and make your changes accordingly.
Then you're left with several ways to run this bot.
If you want to run this code from source, you can just git clone
this repo.
It's recommended to create a new virtual environment (python3 -m venv /path/to/venv
).
This bot uses the python-telegram-bot framework to make Telegram API calls.
You can install it (and potential other requlrements) like that:
pip install -r requirements.txt
Afterwards just run python3 bot.py
and if done right, you'll be left with a working bot.
This project also contains a Dockerfile
as well as a pre-built Docker image hosted on the official Docker Hub.
You will also find the docker-compose.yml
file with which you can easily set up your own instance of the bot.
Just specify the path to your config etc. in said docker-compose file.
The config.py is never included into the container since it contains secrets (such as the bot token). I explicitly excluded it via the .dockerignore file
Python-BlackJackBot/.dockerignore
Line 103 in 3d93215
config.py Instead you should mount the file via a docker volume.
docker run -v ./config.py:/blackjackbot/config.py blackjack