Skip to content

MasterGroosha/telegram-casino-bot

Repository files navigation

(Ru)

🇷🇺 README на русском доступен здесь

Telegram Virtual Casino

In October 2020 Telegram team released yet another update with slot machine dice. Here it is:

slot machine dice

According to Dice type documentation in Bot API, slot machine emits values 1 to 64. In dice_check.py file you can find all the logic regarding matching dice integer value with visual three-icons representation. There is also a test bot @DifichentoBot in Russian to test how it works.
Dice are generated on Telegram server-side, you your bot cannot affect the result.

Technology

  • aiogram — asyncio Telegram Bot API framework;
  • redis — persistent data storage (persistency enabled separately);
  • cachetools — for anti-flood throttling mechanism;
  • Docker and Docker-Compose — quickly deploy bot in containers.
  • Systemd

Installation

Copy env_example file to .env (with leading dot), open and edit it. Create redis_data and redis_config directories, put redis.conf file into the latter (there is example in this repo). Create locales folder with languages subdirs (e.g. locales/en) and put your localization file(s) in those subdirs. Check this directory for samples. Please note that only one language can be active at a time.

Finally, run the bot with docker-compose up -d command.

Alternative way: you can use Systemd services, there is also an example available.

Credits to

  • @Tishka17 for initial inspiration
  • @svinerus for compact dice combination check (f6f42a841d3c1778f0e32)