Interactive telegram bot that allows you to play blackjack on it.
This project works on building a telegram bot that allows users to play blackjack on it. It is one of the most popular casino card games worldwide and the objective of the game is for players to have a hand value as close to 21 as possible without exceeding it, competing against a dealer. This app serves as a way to learn more about the game and also have a go at playing it.
It uses a GameHandler class that is responsible for managing instances of a Blackjack game in a Telegram bot. This structure is helpful when managing multiple games across different chats in Telegram. Each game is identified by a unique ID or chat, and the Singleton pattern ensures that the game state is consistent throughout the bot’s operation. bot.py sets up and runs a Telegram bot that interacts with users to play Blackjack. The bot is flexible, supporting both webhook and polling for update handling, and uses job scheduling to maintain the state of games by cleaning up stale ones. The logging system ensures comprehensive tracking of bot operations and errors, while the configuration file makes it easy to adjust settings without changing the code.