universe docs source
browse docs
docs /extensions /discord

Discord

The Discord extension runs a JDA-powered bot that manages the cluster through slash commands. It covers monitoring, instance lifecycle, and stdin execution, with optional role-based access control and channels for status and console mirroring.

The Discord extension exposes Universe over a chat interface. Operators run slash commands to see cluster status, list instances and configurations, start and stop instances, and pipe commands to a running instance’s stdin. Access can be limited to specific Discord roles, and console output can be mirrored into a channel.

Setup

  1. Create a Discord bot

    In the Discord Developer Portal, create an application, add a bot, and copy its token. Under OAuth2, select the bot and applications.commands scopes and grant Send Messages, Embed Links, Use Application Commands, and Read Message History.

  2. Write the config

    Create ./extensions/discord/config.json with your token and server details:

    {
    	"token": "YOUR_BOT_TOKEN_HERE",
    	"guildId": "123456789012345678",
    	"statusChannelId": "",
    	"logChannelId": "",
    	"embedColor": 5814783,
    	"allowedRoleIds": ["123456789012345678"],
    	"intents": ["MESSAGE_CONTENT", "GUILD_MESSAGES", "GUILD_MEMBERS"]
    }
  3. Install and restart

    Place extension-discord.jar in ./extensions/ and restart Universe. The bot registers its slash commands on startup, scoped to guildId when set.

!
warning

The bot token grants full control of your application. Keep config.json out of version control and treat it like any other secret.

Configuration keys

FieldTypeRequiredPurpose
tokenstringYesBot token from the Developer Portal.
guildIdstringNoServer ID used to scope command registration.
statusChannelIdstringNoChannel for status updates.
logChannelIdstringNoChannel that mirrors console output.
embedColorintegerNoEmbed color (default 5814783).
allowedRoleIdsarrayNoRole IDs allowed to run commands.
intentsarrayNoGateway intents (defaults required for command handling).

Slash commands

CommandParametersFunction
/statusnoneCluster overview: active instance count and configuration count.
/instancesnoneList active instances with state, address, and runtime type.
/configurationsnoneList all configurations.
/instanceidRetrieve details for a specific instance.
/startconfigurationStart an instance from a named configuration.
/stopidStop an instance by ID.
/executeid, commandSend a command string to a running instance’s stdin.

Access control

allowedRoleIds restricts commands to the listed Discord roles. A user without an authorized role receives an error response. An empty array permits everyone. To find a role ID, enable Developer Mode in Discord, right-click the role, and choose Copy Role ID.

i
note

The extension is built on JDA 6.4.1 and Cloud JDA6. Its dependencies are relocated inside the JAR to avoid conflicts with the orchestrator’s own classpath.