A specialized Discord bot by zqil for The Strongest Battlegrounds community.
Tired of getting teamed on in The Strongest Battlegrounds? Celestial Sentry is designed to help you quickly rally support. It provides a streamlined system for requesting backup, notifying allies, and tracking the outcomes of your battles.
- Rapid Backup Requests: Use the
/backupcommand (with a 60-second cooldown per user) to instantly create a clear, detailed request embed. - Targeted Pings: Pings a specific, configurable role (e.g.,
@Backup Squad) to notify allies effectively. - Detailed War Info: Embeds display the user in need, opponent names, region, and an optional join link. Embed color and thumbnail are customizable via
/setup. - Interactive Battle Controls: Users can conclude active engagements with
Win,Lose, orTrucebuttons, and the request author or an admin can useEdit Oppsto update the opponent list. - Persistent War Statistics: Automatically tracks server-wide statistics (win/loss ratio, total engagements, average duration) using the
/warstatscommand. Data is saved persistently inwar_data.json. - Comprehensive Admin Tools: Includes easy server setup (
/setup), testing functionality (/debugbackup), and data management (/resetstats). - Reliable Operation: Built-in error handling, permissions checks, and persistent data management ensure the bot operates reliably even after restarts.
This guide explains how to get the pre-compiled CelestialSentry.exe running on a Windows system.
If you already have a token and the bot is invited, skip to Step 4.
- Go to the Discord Developer Portal: Navigate to Discord Developers.
- Create a New Application: Click "New Application" and give your bot a name.
- Get the Token & Configure Intents:
- In the Application menu, go to the Bot tab.
- Click Add Bot, then confirm.
- Under "Token", click Copy. This is your secret
DISCORD_TOKEN. Keep this private. - Crucial Step: Under "Privileged Gateway Intents", enable PRESENCE INTENT and SERVER MEMBERS INTENT. These are required for the bot to check member permissions and manage roles effectively.
- Generate Invite Link:
- Go to the OAuth2 -> URL Generator tab.
- Under "SCOPES", select
botandapplication.commands. - Under "BOT PERMISSIONS", select
Send Messages,Embed Links,Read Message History, andMention Everyone. - Copy the generated URL and use it to invite the bot to your server.
-
Download and Extract
- Download the latest release
.zipfile from the Releases Page. - Create a new, dedicated folder (e.g.,
C:/CelestialSentry). - Extract the contents (
CelestialSentry.exe,example.env, etc.) into this folder.
- Download the latest release
-
Configure
.env- In your folder, rename
example.envto.env. - Open the
.envfile with a text editor. - Paste your Discord Token (obtained in Step 3) inside the quotes:
DISCORD_TOKEN="YOUR_SECRET_TOKEN_HERE" - Save and close the file.
- In your folder, rename
-
Run the Bot
- Double-click
CelestialSentry.exe. - The bot will now be running. A
bot.logfile will be created in the same folder for logging activity and errors.
- Double-click
-
Server Setup
- Create a role for people who want to be notified for backup (e.g.,
@Backup Squad). - Create a dedicated channel for requests (e.g.,
#backup-requests). - As a server administrator, run the
/setupcommand in any channel. Example usage:/setup backup_channel:#backup-requests backup_role:@Backup Squad embed_color:#FF5733 thumbnail_url:https://myimage.com/logo.png - The
embed_colorandthumbnail_urlparameters are optional for visual customization.
- Create a role for people who want to be notified for backup (e.g.,
The bot is now fully configured and ready for action!
Since the compiled bot runs without a command line window (console=False), use these methods to manage it:
- Right-click
CelestialSentry.exeand select Create shortcut. - Press the Windows Key + R, type
shell:startup, and press Enter. - Move the shortcut into the opened "Startup" folder. The bot will now launch automatically when the user logs into Windows.
- Press Ctrl + Shift + Esc to open the Task Manager.
- Go to the "Details" or "Processes" tab.
- Find and select
CelestialSentry.exe. - Click End task.
On macOS, use the Activity Monitor.
| Command | Parameters | Description | Cooldown | Permissions |
|---|---|---|---|---|
/help |
None | Shows a list of all available commands. | N/A | Everyone |
/backup |
roblox_user, opps, region, [link] |
Creates a backup request, pings the configured role, and records war data upon conclusion. | 60 seconds per user | Everyone |
/warstats |
None | Displays a summary of all concluded battles for the server (W/L/T ratio, average duration). | N/A | Everyone |
/setup |
backup_channel, backup_role, [embed_color], [thumbnail_url] |
Configures the primary channel and role. Optional parameters allow customization of embed appearance. | N/A | Administrator |
/debugbackup |
roblox_user, opps, region, [link] |
Creates a backup request without pinging the role or recording statistics. Ideal for testing configurations. | N/A | Administrator |
/resetstats |
None | WARNING: Prompts for confirmation to delete all recorded war statistics for the server. This is irreversible. | N/A | Administrator |
These buttons appear on the backup request embed. Only the original author of the request or a server administrator can use them.
Win/Lose/Truce: Ends the request, updates the embed, and records the result for/warstats.Edit Opps: Opens a pop-up modal allowing the user to modify the list of opponents in an active request.
Want to run the bot from source or contribute?
- Python 3.8+
- Git
# Clone the repository
git clone https://github.com/zqil/CelestialSentry.git
cd CelestialSentry
# Create and activate a virtual environment
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt- Create a
.envfile in the root directory following the instructions in the Quick Start. - (Recommended) If developing, open
celestialsentry.pyand change theDEV_GUILD_IDvariable (around line 287) to your private test server's ID. This will force slash command synchronization instantly during development.
python celestialsentry.pyThis project uses PyInstaller to create a standalone executable for Windows based on the bot.spec configuration file.
-
Install PyInstaller:
pip install pyinstaller
-
Run the Build Command: The
bot.specfile contains all necessary configuration, including hidden imports and the icon path. (Execute this from the project's root directory)pyinstaller bot.spec
-
Find the Executable:
- The final
CelestialSentry.exewill be located in the newly createddistfolder. - To run it, place the
.exein a new folder alongside a configured.envfile. The data files (config.json,war_data.json, andbot.log) will be generated automatically in that folder on the first run.
- The final