This repository contains a Python-based betting bot for the Bac Bo game that monitors game results, sends Telegram notifications, and uses specific betting strategies to automate bets. The bot integrates with Telegram to provide real-time alerts and updates, including scoreboard details and bet outcomes.
- Automated Bet Execution: Uses custom strategies to identify betting patterns and automatically places bets accordingly.
- Telegram Integration: Sends notifications, bet instructions, and updates to a specified Telegram channel.
- Daily Restart: The bot is scheduled to restart daily to maintain stability.
- Custom Betting Strategies: You can define your own patterns and betting behaviors.
- Scoreboard Tracking: Tracks wins, losses, and calculates assertivity (win rate).
- Docker Support: Easily deployable using Docker.
- Python 3.10
- Google Chrome & Chromedriver
- Selenium
- A Telegram bot token and channel ID
- Docker (optional for containerized deployment)
-
Clone the repository:
git clone https://github.com/yourusername/telegram-betting-bot.git cd telegram-betting-bot
-
Set up environment variables: Create a
.env
file in the root directory with the following content (you can use the.env-example
file as a reference):TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHANNEL_ID=your_telegram_channel_id WIN_STICKER_ID=your_win_sticker_id LOSS_STICKER_ID=your_loss_sticker_id CLOSE_STICKER_ID=your_close_sticker_id OPEN_STICKER_ID=your_open_sticker_id LOGIN_USERNAME=your_login_username LOGIN_PASSWORD=your_login_password
Replace the placeholders with your actual Telegram bot token, channel ID, stickers, and login credentials.
-
Install dependencies: Make sure you have
pip
installed, then run:pip install -r requirements.txt
-
Install Google Chrome and Chromedriver: This bot uses Selenium, which requires Chrome and Chromedriver:
- Chrome: Download here
- Chromedriver: Make sure it matches the installed Chrome version. Download here
-
Run the bot:
python main.py
-
Build the Docker image:
docker build -t telegram-betting-bot .
-
Run the Docker container:
docker run -d --env-file .env --name betting-bot telegram-betting-bot
The bot uses customizable betting strategies defined in the strategies
variable. Each strategy consists of:
- Pattern: The sequence to match before placing a bet.
- Bet: The action to take if the pattern is matched.
For example:
strategies = [
{'pattern': ['P', 'P', 'P'], 'bet': 'B'},
{'pattern': ['B', 'B', 'B'], 'bet': 'P'},
]
'P'
and'B'
represent different bet options.
The bot tracks the number of wins, losses, and calculates the assertivity rate (win rate). The scoreboard is displayed after each bet, and updates are sent to the Telegram channel.
To ensure the bot runs smoothly, it automatically restarts daily at a predefined time. You can modify the restart time in the schedule_restart
function in main.py
.
- The bot will continuously monitor the Bac Bo game results and apply the betting strategy as defined.
- Alerts are sent to the specified Telegram channel, including bet instructions, win/loss notifications, and scoreboard updates.
- Stickers are sent for different events (e.g., start, win, loss) if configured.
- Gambling Disclaimer: This bot is intended for educational purposes only. Betting involves risks, and the bot does not guarantee winning results.
- Telegram API Limits: Make sure not to exceed Telegram's rate limits to avoid being blocked.
- Use Responsibly: Automating bets can lead to significant financial loss. Use at your own risk.
This project is licensed under the MIT License. See the LICENSE
file for details.
Feel free to open issues or submit pull requests if you have any improvements or suggestions for the bot.