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 settings.example.toml file to settings.toml, open and edit it.
To change bot's language, overwrite bot/locale/current directory contents with a chosen language. For example, you want to use English language in your bot. Then, in bot/locale/current create a directory named en and place your .ftl files inside. Check this directory for samples. Please note that only one language can be active at a time.

Finally, run the bot with docker-compose --profile "all" 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)

Note on versioning

For most of my Telegram bots, I plan to use Calendar Versioning with the following rules:

  • Versions should look like vAAAA.BB.C, where:
    • vAAAA is the letter "v" followed by the 4-digit year of release, e.g., v2025.
    • BB is the 2-digit month number, e.g., 06 for June.
    • C is the release number for that month, not zero-padded, e.g., 1 for the first release in June. For example, the first release to use the new versioning schema will be tagged as v2025.06.1.

This scheme makes it easier to understand which Bot API features might be supported in a given release and which are definitely not.