Build Your Own Dice Bot Using Windice API

domdom

Active member
Messages
96
Reaction score
222
Points
33
Hello Windicers!

Not many people know that we can actually create our own custom dice bot tailored to our favorite strategies. Fortunately, Windice provides a full-featured interface for this through the official Windice API https://windice.org/docsapi

In this thread, I’d like to share how to build a simple desktop dice bot using Python. I’ve structured this guide to be super straightforward and easy to digest, especially for beginners who have never touched programming before.

Instead of just imagining it, here is a screenshot of the completed bot application
mybot.png

Why Build This Simple Bot?​

You might be wondering: What is the actual use of a simple bot like this?

Have you ever joined Mod Siopaw's or Beky’s Rollhunt or Forum Challenge where you are required to hit a specific target number with a required payout?
  • Siopaw Style: Dice hunt the exact number 1234 with a payout of 3x or higher.
  • Beky Style: Hunt the number closest to 2000 or hit 2000 (bullseye) , any payout.
  • Forum Challenge Style: Hunt lucky numbers like 4444, 7777, or 8888 as many as you can.
Normally, doing this manually means staring at your screen for hours, squinting at every single roll result. But with this bot, you can automate it easily! Here is how you set it up for a Siopaw-style hunt:
  • Configure the Range: Enter 0 to 3000 in the Range box. The Payout field will automatically calculate and show 3.265
  • Set Your Target: Enter 1234 - 1234 in the Target box.
  • Set No. Bets: Enter your desired roll limit, for example, 4000.
  • Hit [Start]: Sit back and let the bot run in the background.
When roll 1234 hits, the bot will instantly play an audio alert, pause the session, and popup a notification asking whether you want to Continue or Stop
targethit.png
You no longer have to monitor the dice manually roll-by-roll. Once you hit your target, you can easily share your winning bet link via the website's "My Bets" section just like usual!

Overview & Features​

Key Elements Explained:
- Account Info: Displays your Username and live Balance. The balance updates automatically so you can track your funds effortlessly.
- Betting Settings:
  • Coins: A dropdown menu to select your currency (WIN, USDT, TRX, etc.).
  • Bet Size: Your wager amount. The bot includes an Auto Detect Minimum Bet feature, if your input is below the limit, the bot automatically adjusts it to Windice's min. bet size.
  • Range, Payout, Target, & No. Bets: Fully customizable to fit your specific dice strategy.
  • Safety Lock ([Start] / [Stop] Buttons): Once you click [Start], the Coins dropdown and Bet Size fields are locked to prevent accidental parameter changes mid-session.
  • Betting Results: A history table showing every roll. Winning bets (WIN) in green and losses (LOSS) in red for quick visual tracking.
- Audio Notifications: Plays an instant .wav sound alert every time you hit targeted result!

Understanding the Code Structure (3 Main Sections)
To make reading the code easier for beginners, the Python script is organized into 3 primary sections from top to bottom:

1. Library Imports (Top)
Here we import the necessary built-in and external Python modules:
  • tkinter & ttk: To build the graphical user interface (GUI).
  • requests: To communicate with the Windice API endpoints. Need to install this one later
  • winsound: To play .wav sound effects asynchronously without freezing the app.
2. Logic & Core Functions (Middle)
This section acts as the "brain" of the bot, containing functions triggered by user actions or automated loops:
  • User Info Fetcher (get_user_info_api): Sends your API Key (GET /api/user) to retrieve your username and keep your live balance updated.
  • Roll API Function (place_roll_api): Handles communication with the Windice server by sending automated dice roll requests
  • Payout Function (calculate_payout): Automatically calculates potential multiplier payouts based on your chosen range and the configured house edge.
  • Betting Loop (start_betting_loop) & Auto Detect Min Bet: Serves as the core control center that executes bets repeatedly in a separate thread. Within this loop, the bot also handles Auto Detect Min Bet parsing error responses if a bet size is too low, extracting the allowed minimum, and auto correcting the field in the GUI. It checks if a roll hits your target, triggers audio alerts, and opens a confirmation popup to pause or stop the bot
  • Audio Notification (play_victory_chime): Smoothly plays the mybot-win.wav sound effect in the background the moment your target number is hit without freezing the app GUI.
3. GUI Layout & Form Design (Bottom)

The final part builds the visual interface before initiating root.mainloop() :
  • Two-Column Layout: Uses frames for a clean look (Left for Betting Settings, Right for Account Info ).
  • Form Inputs: Builds the dropdowns, text entries, and labels with aligned column widths.
  • Results Treeview: Renders the history table at the bottom with custom color tags.
  • Action Buttons: Connects the [Start] and [Stop] buttons directly to the core functions.

Full Python Source Code
(See first reply below)

Setup & How to Run
  1. Install Python: download the Windows Installer from the official site. https://www.python.org/downloads/
    Important: Make sure to check the box "Add Python to PATH" during installation.
  2. Use a Lightweight Text Editor (Recommended: Notepad++):
    • Download and install Notepad++ (free & lightweight) https://notepad-plus-plus.org/downloads/
    • Open Notepad++, paste the Python code, and save it as mybot.py (ensure the file extension is .py, not .txt).
  3. Install Requests Library: Open Command Prompt(CMD) on Windows and run:
    Code:
    pip install requests
  4. Audio File Setup: Place your preferred sound file named mybot-win.wav in the exact same folder as mybot.py
  5. Copy your Windice API Key from https://windice.org/cabinet/settings, then open the API tab, click the copy icon and paste it into your code
  6. Launch the Bot: Double-click “mybot.py” (or run “python mybot.py” via CMD). pick your Coin, adjust your parameters, and click [Start]
If you want a clean standalone application where the .exe is generated directly in the same folder, you can use this automated batch script:
  1. Open Notepad++, paste the compile.bat code, and save it as compile.bat (see first reply below)
  2. Double-click compile.bat.
  3. Once finished, the script will automatically clean up all unnecessary folders, leaving your brand new mybot.exe right there ready to run!
I know not everyone is interested in the coding process, step by step. Some just want the finished result, so I’ve included the files in a zip for you to download.
Link to download mybot : https://files.catbox.moe/npwj1k.zip
The zip file contains 3 files: mybot.py, mybot-win.wav, and compile.bat. Password to open the zip file : windice.io

Disclaimer: This bot was created purely for educational purposes, personal enjoyment, and exploring the Windice API. Only gamble with funds you can afford to lose, and always practice responsible gaming and proper risk management. Use it at your own risk!
 
Full Source Code (mybot.py) & Compile.bat Script

Due to the forum's 10,000-character limit per post, the complete source code cannot fit directly within this thread. The full Python source code (mybot.py) has been hosted on Pastebin, or you can download the provided ZIP file and open it with your code editor.

Full Python Source Code (mybot.py): https://pastebin.com/YrJ2xFeJ

[Take a closer look at the code. I’ve added comments to help you understand how everything works]

Compile.bat

Code:
@echo offtitle Compile MyBot to EXE
echo Installing PyInstaller...
pip install pyinstaller --quiet
echo Compiling mybot.py...
pyinstaller --onefile --noconsole --distpath . mybot.py
echo Cleaning up temporary folders...
rmdir /s /q build
del /q mybot.spec
echo Build complete! mybot.exe is ready in this folder.
pause
 
Top