StaffHQ
Docs/Setup/Discord Bot

Discord Bot

Set up the StaffHQ Discord bot to expose slash commands to your moderation team.

The StaffHQ Discord bot gives your moderation team instant access to player data from Discord. You can either self-host the bot on your own infrastructure, or pay for managed hosting and let us handle it.

Self-host

Run the bot on your own server. Requires Python 3.10+ and a systemd service (or Docker). Free.

Managed hosting

We run, monitor, and update the bot. Enable it from the dashboard. Costs 299 credits (GBP 2.99) per month.

Step 1: Create a Discord application

1

Open the Discord Developer Portal

Go to discord.com/developers/applications and click New Application. Name it whatever you want (e.g. "My Network Staff Bot").
2

Create a bot user

Go to the Bot tab on the left. Click Add Bot. Copy the Token and save it securely.
3

Enable required intents

On the same Bot tab, scroll to Privileged Gateway Intents and enable:
  • + Server Members Intent
  • + Message Content Intent
4

Invite the bot to your server

Go to OAuth2 > URL Generator. Under Scopes, tick bot and applications.commands. Under Bot Permissions, tick:
  • + Send Messages
  • + Embed Links
  • + Read Message History
  • + View Channels
Copy the generated URL and open it to invite the bot.

Step 2: Register your guild in the dashboard

1

Go to the Discord page

In the dashboard, open the Discord section.
2

Enter bot credentials

Fill in:
  • Client ID - from the OAuth2 General tab in the developer portal
  • Bot Token - from the Bot tab
  • Guild ID - right-click your Discord server and select Copy Server ID
  • Alert Channel ID - right-click the channel for bot alerts and select Copy Channel ID
3

Save and verify

Click Save. The dashboard will attempt to connect to the bot. If successful, the bot will post a verification message in the alert channel.
Warning
Developer Mode must be enabled in Discord to copy server and channel IDs. Enable it under User Settings > Advanced > Developer Mode.

Self-host setup

The bot is open source at github.com/AkidHunter/staffhq-bot.

Requirements

  • + Python 3.10 or later
  • + pip packages: discord.py, aiohttp, python-dotenv

Installation

bash
git clone https://github.com/AkidHunter/staffhq-bot
cd staffhq-bot
pip install -r requirements.txt
cp .env.example .env

.env file

env
DISCORD_TOKEN=your_bot_token_here
STAFFHQ_API_KEY=your_dashboard_api_key_here
DASHBOARD_API_URL=https://dash.staffhq.net
Note
The API key for the bot must be a Dashboard-type key, not a Plugin key. Generate one in Settings > API Keys.

Run with Python

bash
python bot.py

Systemd service (recommended for production)

ini
[Unit]
Description=StaffHQ Discord Bot
After=network.target

[Service]
Type=simple
User=staffhq
WorkingDirectory=/opt/staffhq-bot
EnvironmentFile=/opt/staffhq-bot/.env
ExecStart=/usr/bin/python3 bot.py
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
bash
sudo systemctl daemon-reload
sudo systemctl enable --now staffhq-bot
sudo systemctl status staffhq-bot

Managed hosting

With managed hosting, StaffHQ runs the bot for you. You do not need a server or Python environment.

  • +Cost: 299 credits (GBP 2.99) per month, deducted from your credit balance
  • +Includes automatic bot updates when new slash commands are released
  • +24/7 uptime monitoring
  • +Enable and disable from the dashboard at any time

To enable, open Discord in the dashboard and toggle Managed Hosting. You will still need to provide your bot token and guild credentials.

← PreviousDashboardNext →Commands