Documentation Menu
Back to Channels

Discord Bot Setup

Gateway API bot with slash command support

Overview

The Discord bot enables SingularCore to receive commands and send notifications through Discord servers. It supports slash commands, message intents, and role-based permissions for secure access control.

Difficulty

Easy

Setup Time

5 minutes

Notification Tiers

Normal, High, Urgent

Prerequisites

  • Discord account
  • Discord server where you have administrator permissions
  • Python 3.9+
  • discord.py library

Step-by-Step Setup

1

Create Discord Application

  1. Go to the Discord Developer Portal
  2. Click "New Application"
  3. Name your application (e.g., "SingularCore Bot")
  4. Click "Create"
2

Create Bot

  1. In your application, go to the "Bot" tab on the left sidebar
  2. Click "Add Bot" and confirm
  3. Under "Privileged Gateway Intents", enable:
    • Message Content Intent
    • Server Members Intent
  4. Click "Save Changes"
3

Get Application ID and Bot Token

  1. In the "General Information" tab, copy the Application ID
  2. In the "Bot" tab, click "Reset Token"
  3. Save the bot token securely - you won't see it again!
4

Add Bot to Server

  1. In the "OAuth2" tab, go to "OAuth2 URL Generator"
  2. Under "Scopes", select bot and applications.commands
  3. Under "Bot Permissions", select:
    • Send Messages
    • Read Message History
    • Embed Links
    • Attach Files
    • Use Slash Commands
  4. Copy the generated URL and open it in your browser
  5. Select your server and authorize the bot
5

Get Guild ID

  1. In Discord, enable Developer Mode:
    • User Settings → Advanced → Developer Mode (ON)
  2. Right-click your server name
  3. Click "Copy Server ID"
6

Configure Bot

Edit config/comms.json:

{
  "discord": {
    "enabled": true,
    "bot_token": "your_bot_token_here",
    "application_id": "your_application_id_here",
    "guild_id": "your_guild_id_here",
    "allowed_roles": ["Admin", "Moderator"],
    "auto_setup": true,
    "command_prefix": "/"
  }
}

Supported Commands

CommandDescriptionTier
/statusSystem health check0
/skillsList all skills0
/dreamView last dream summary0
/approve <id>Approve pending action1+
/reject <id>Reject pending action1+
/stopPause heartbeat1+
/resumeResume heartbeat1+

Troubleshooting

Bot Not Responding

  • Verify bot token is correct and not expired
  • Check that bot has proper permissions in the server
  • Ensure Message Content Intent is enabled in Bot settings
  • Check that the bot is online in the server member list

Slash Commands Not Appearing

  • Verify applications.commands scope was granted
  • Check that auto_setup is enabled in config
  • Wait up to an hour for global command registration, or use guild-specific commands
  • Restart the bot after configuration changes

"Missing Access" Error

  • Verify bot has been added to the correct server
  • Check that your role is in allowed_roles config
  • Ensure bot has appropriate channel permissions

Need More Details?

View the complete setup guide with code examples, advanced configuration, and security best practices.

View Full Documentation