Discord Bot Setup
Run one bot process per key system to let buyers redeem keys, reset their HWID, open support tickets, and pull their personalized loader — all from your Discord server.
What the bot is
The Discord bot is one of the three clients of your Quark key system. The website hosts the database and API and is the single source of truth; the Windows software and the Discord bot are both clients of it. Anything you change in one place syncs to all three, so a key redeemed through the bot, a HWID reset from the dashboard, and a license edited in the software all describe the same record.
You run one bot process per key system. If you operate several key systems, each one gets its own bot application, its own token, and its own process. The bot does not talk to your buyers' executors — it only talks to the Quark API on their behalf and manages roles, channels, and messages inside your Discord server.
Before you start, you need a key system already created in the software's Key System tab. Creating it is what gives you the KEY_SYSTEM_ID and the one-time api_secret the bot needs. If you have not done that yet, create the key system first, then come back here.
Step 1 — Create the Discord application
BOT_TOKEN. Treat it like a password: anyone with it can control your bot. You only see it once, so store it somewhere safe now.CLIENT_ID.Step 2 — Invite the bot to your server
The bot must be invited with the correct scopes and permissions or its commands will not register and it will not be able to grant roles or create ticket channels. Build an invite URL with these two scopes:
bot— lets it join as a bot userapplications.commands— lets it register slash commands like/paneland/redeem
And these permissions, which map directly to what its commands do:
- Manage Roles — to grant and remove the buyer role on redeem and whitelist commands
- Manage Channels — to create and close ticket channels under your ticket category
- Send Messages — to post panels, embeds, and replies
You can generate the URL in the Developer Portal under OAuth2 → URL Generator: tick the two scopes, tick the three permissions, then open the resulting link and pick your server. Or build it by hand — replace YOUR_CLIENT_ID with your Application ID:
https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot%20applications.commands&permissions=268435472Make sure the bot's role sits above the buyer role in your server's role list. Discord will not let a bot assign a role that is higher than its own highest role, so if the buyer role is above the bot's role, /redeem will fail to grant it.
Step 3 — Configure the .env file
The bot reads its configuration from a .env file in the bot folder. Create it (copy .env.example if one is provided) and fill in all six values:
BOT_TOKEN=your-bot-token-from-the-bot-tab
CLIENT_ID=your-application-id
GUILD_ID=your-discord-server-id
API_BASE=https://quarkexploits.com
KEY_SYSTEM_ID=your-key-system-id
API_SECRET=the-secret-shown-once-on-key-system-creation| Variable | What it is | Where to get it |
|---|---|---|
BOT_TOKEN | Secret token that authenticates the bot to Discord | Developer Portal → Bot tab → Reset Token |
CLIENT_ID | Your application's ID, used to register slash commands | Developer Portal → General Information → Application ID |
GUILD_ID | The one server the bot is allowed to run in | Right-click your server in Discord with Developer Mode on → Copy Server ID |
API_BASE | Base URL of the Quark API | Always https://quarkexploits.com |
KEY_SYSTEM_ID | Which key system this bot serves | The Key System tab in the software |
API_SECRET | Authenticates the bot to your key system's API | Shown once when you created the key system |
The api_secret is displayed exactly one time, at key system creation. It is not stored anywhere you can read it back. If you lose it, you cannot recover it — you will need to rotate it from the key system settings and update the bot's .env with the new value. Keep it out of screenshots, out of your repo, and out of any channel your buyers can see.
Step 4 — Install and start
The bot is a Node process. From inside the bot folder, install its dependencies once, then start it:
npm install
npm startOn start the bot registers its slash commands, connects to Discord, and locks itself to the server in GUILD_ID. Once it is online you should see its commands appear when you type / in your server. If commands do not show up, confirm the bot was invited with the applications.commands scope and that CLIENT_ID is correct.
Single-server lockdown
The bot is deliberately built to run in exactly one server. It locks itself to the server you set in GUILD_ID, and if it is ever added to any other server it leaves that server automatically. This is a protection: it stops someone who gets hold of your invite link or token from pointing your key system's bot at a different community, and it keeps one bot process tied cleanly to one key system. Do not try to run a single bot across multiple servers — spin up a separate application and process per key system instead.
Hosting the bot
The bot needs to stay running for its commands to work, so it has to live somewhere that keeps a Node process alive around the clock. Running npm start on your own PC works for testing, but the bot goes offline the moment you close it or shut down. For anything real, host it on a platform that keeps the process up:
- Railway — simple to deploy a Node app from a repo, set the six variables in its dashboard
- A VPS — full control; keep it alive with a process manager like
pm2or a systemd service - Pterodactyl — if you already run a game/bot panel
On any host, set the same six environment variables you put in .env. Never commit the .env file or paste the token/secret into a public place.
Commands
The bot ships with a full command set. The most important ones for a working key system are described below; the rest are listed after.
| Command | What it does |
|---|---|
/panel | Posts the main whitelist/redeem panel embed in your server — the buyer-facing hub where users start the redeem flow |
/redeem | Links a license key to the Discord user, grants them the buyer role, and returns their personalized loader |
/reset | Resets the HWID bound to a license so the user can run it on a new machine — subject to a cooldown to stop abuse |
/ticketpanel | Posts the support ticket panel; users open a ticket from it and the bot creates a channel under your ticket category |
/verification | Posts the verification prompt for gating access |
/whitelist | Whitelist a user manually |
/unwhitelist | Remove a user from the whitelist |
/whitelisted-users | List everyone currently whitelisted |
/user-history | Show a user's redeem/reset history for support |
/close | Close the current ticket channel |
/status | Show bot / key system status |
/leaderboard | Show a leaderboard for your community |
/help | List the available commands |
How the key ones fit together
A typical setup is: run /panel once to post the redeem hub and /ticketpanel once to post the support hub. From there, a buyer uses /redeem (or the panel) to link their key — that binds the key to their Discord account, gives them the buyer role, and hands back a loader personalized to their license. When someone changes machines and hits the HWID lock, /reset clears the bound HWID so it can re-bind on their next run, with a cooldown so it cannot be spammed. HWID can also be reset from the dashboard if you prefer to do it yourself.
Toggling commands auto-syncs
You control which commands are available from the software. When you toggle a command on or off in the Quark software, that change auto-syncs to the bot — because the website is the single source of truth and the bot is just a client of it. You do not need to restart the bot or edit any code to enable or disable a command; flip it in the software and the bot reflects it.
Stuck on setup? The community Discord is at discord.gg/AvfJCzRgUz.