LogoRobo.js

Configuration

Configure the Discord plugin

Configure @robojs/discordjs through a plugin configuration file at config/plugins/robojs/discordjs.ts.

For the complete reference including environment variables, client access helpers (getClient, hasClient), type re-exports, and the plugin logger, see the @robojs/discordjs Configuration reference.

VS Code editor showing config/plugins/robojs/discordjs.ts with TypeScript autocomplete displaying available DiscordConfig properties like clientOptions, sage, testServers, and defaults

FocusThe TypeScript autocomplete showing available DiscordConfig propertiesZoom100%NotesOpen config/plugins/robojs/discordjs.ts in VS Code. Trigger autocomplete on a property. Show IntelliSense listing clientOptions, sage, testServers, defaults, autoRegisterCommands.

Plugin Configuration

config/plugins/robojs/discordjs.ts
import type { DiscordConfig } from '@robojs/discordjs'

export default {
	clientOptions: {
		intents: ['Guilds', 'GuildMessages', 'GuildMembers']
	},
	sage: {
		defer: true,
		deferBuffer: 250,
		ephemeral: false
	},
	testServers: ['123456789012345678']
} satisfies DiscordConfig
config/plugins/robojs/discordjs.mjs
export default {
	clientOptions: {
		intents: ['Guilds', 'GuildMessages', 'GuildMembers']
	},
	sage: {
		defer: true,
		deferBuffer: 250,
		ephemeral: false
	},
	testServers: ['123456789012345678']
}

The satisfies DiscordConfig annotation gives you autocomplete and type checking without changing the inferred type of the export.

Client Options

The clientOptions field passes directly through to the Discord.js Client constructor. Intents are specified as PascalCase strings such as 'Guilds', 'GuildMessages', and 'MessageContent'.

Command Defaults

The defaults field sets default values for all commands. These can be overridden per command in individual command configs.

config/plugins/robojs/discordjs.ts
import type { DiscordConfig } from '@robojs/discordjs'

export default {
	defaults: {
		contexts: ['Guild', 'BotDM'],
		integrationTypes: ['GuildInstall']
	}
} satisfies DiscordConfig
config/plugins/robojs/discordjs.mjs
export default {
	defaults: {
		contexts: ['Guild', 'BotDM'],
		integrationTypes: ['GuildInstall']
	}
}
FieldTypeDescription
contexts('Guild' | 'BotDM' | 'PrivateChannel')[]Where commands are available
integrationTypes('GuildInstall' | 'UserInstall')[]Install types that can use commands
defaultMemberPermissionsstring | number | bigintRequired permissions for all commands

Sage

Global Sage mode options control automatic deferrals, ephemeral replies, and error handling. Set to false to disable Sage entirely. See the Sage Mode page for details on each option.

Test Servers

The testServers array restricts command registration to specific server IDs during development. This speeds up iteration since guild commands update instantly, unlike global commands which can take up to an hour.

Auto Register Commands

The autoRegisterCommands field controls when Robo.js registers slash commands with Discord.

ValueBehavior
true (default)Register on every build (runs during robo dev and robo build)
falseNever register automatically
['production']Register only in listed modes

Timeouts

The timeouts field configures time limits for various operations.

OptionDefaultDescription
timeouts.autocomplete3000Autocomplete response timeout (ms)
timeouts.commandDeferral250Time before auto-deferring (ms)
timeouts.commandRegistration30000Command registration timeout (ms)

Robo Configuration

Framework-level settings such as logger configuration, heartbeat intervals, and environment variables go in config/robo.ts. This page covers only the Discord plugin configuration. See the Robo.js core documentation for the full config/robo.ts reference.

Mode-Specific Configuration

Create mode-specific overrides by appending the mode name to the filename. These files merge with the base config when running in the corresponding mode. Mode-specific files override matching fields; unspecified fields keep their base values.

  • Developmentconfig/plugins/robojs/discordjs.development.ts
  • Productionconfig/plugins/robojs/discordjs.production.ts
discordjs.tsBase config
discordjs.development.tsDev overrides
discordjs.production.tsProduction overrides

This is useful for setting testServers only in development or enabling autoRegisterCommands only in production.

Configuration Reference

FieldTypeDefaultDescription
autoRegisterCommandsboolean | string[]trueWhen to register commands
clientOptionsClientOptions-Discord.js client options
defaultsCommandDefaults-Default command settings
sagefalse | SageOptions{}Sage mode configuration
testServersstring[]-Dev server IDs
timeoutsTimeoutConfig-Operation timeouts

Next Steps

On this page