Skip to main content

Interface: SapphireClientOptions

Properties

baseUserDirectory?

optional baseUserDirectory: null | string | URL

The base user directory, if set to null, Sapphire will not call StoreRegistry.registerPath(), meaning that you will need to manually set each folder for each store or use StoreRegistry.loadPiece(). Please read the aforementioned methods' documentation for more information.

Since

1.0.0

Default

undefined

Defined in

projects/framework/src/lib/SapphireClient.ts:48


caseInsensitiveCommands?

optional caseInsensitiveCommands: null | boolean

Whether commands can be case-insensitive

Since

1.0.0

Default

false

Defined in

projects/framework/src/lib/SapphireClient.ts:55


caseInsensitivePrefixes?

optional caseInsensitivePrefixes: null | boolean

Whether prefixes can be case-insensitive

Since

1.0.0

Default

false

Defined in

projects/framework/src/lib/SapphireClient.ts:62


defaultCooldown?

optional defaultCooldown: CooldownOptions

Sets the default cooldown time for all commands.

Default

"No cooldown options"

Defined in

projects/framework/src/lib/SapphireClient.ts:149


defaultPrefix?

optional defaultPrefix: SapphirePrefix

The default prefix, in case of null, only mention prefix will trigger the bot's commands.

Since

1.0.0

Default

null

Defined in

projects/framework/src/lib/SapphireClient.ts:69


disableMentionPrefix?

optional disableMentionPrefix: boolean

Controls whether the bot has mention as a prefix disabled

Default

false

Defined in

projects/framework/src/lib/SapphireClient.ts:154


enableLoaderTraceLoggings?

optional enableLoaderTraceLoggings: boolean

Whether trace logging should be enabled.

Since

2.0.0

Default

container.logger.has(LogLevel.Trace)

Defined in

projects/framework/src/lib/SapphireClient.ts:115


fetchPrefix?

optional fetchPrefix: SapphirePrefixHook

The prefix hook, by default it is a callback function that returns SapphireClientOptions.defaultPrefix.

Since

1.0.0

Default

() => client.options.defaultPrefix

Defined in

projects/framework/src/lib/SapphireClient.ts:94


id?

optional id: string

The client's ID, this is automatically set by the CoreReady event.

Since

1.0.0

Default

this.client.user?.id ?? null

Defined in

projects/framework/src/lib/SapphireClient.ts:101


loadApplicationCommandRegistriesStatusListeners?

optional loadApplicationCommandRegistriesStatusListeners: boolean

If Sapphire should load the pre-included application command registries status listeners that log the status of registering application commands to the SapphireClient.logger instance. This includes the events Events.ApplicationCommandRegistriesInitialising and Events.ApplicationCommandRegistriesRegistered.

Since

4.4.0

Default

true

Defined in

projects/framework/src/lib/SapphireClient.ts:123


loadDefaultErrorListeners?

optional loadDefaultErrorListeners: boolean

If Sapphire should load the pre-included error event listeners that log any encountered errors to the SapphireClient.logger instance

Since

1.0.0

Default

true

Defined in

projects/framework/src/lib/SapphireClient.ts:130


loadMessageCommandListeners?

optional loadMessageCommandListeners: boolean

If Sapphire should load the pre-included message command listeners that are used to process incoming messages for commands.

Since

3.0.0

Default

false

Defined in

projects/framework/src/lib/SapphireClient.ts:137


logger?

optional logger: ClientLoggerOptions

The logger options, defaults to an instance of Logger when ClientLoggerOptions.instance is not specified.

Since

1.0.0

Default

{ instance: new Logger(LogLevel.Info) }

Defined in

projects/framework/src/lib/SapphireClient.ts:108


preventFailedToFetchLogForGuilds?

optional preventFailedToFetchLogForGuilds: true | string[]

Whenever starting the bot process Sapphire may report errors when failing to fetch guild commands. One of the causes for this can be when a bot was invited to a server without the application.commands scope.

Normally this produce a log in the console at the WARN level, however because bot lists have a tendency to invite your bot specifically without the scope to ensure that your Chat Input and Context Menu commands do not show up as usable commands in that server, you may want to include their guild ids in this list.

By adding ids to this list, whenever a guild id matches one of the ids in the list no warning log message will be emitted for that guild.

By setting this value to true, no warning log message will be emitted for any guilds we couldn't fetch the commands from.

Note that this specifically applies to the warning log:

ApplicationCommandRegistries: Failed to fetch guild commands for guild <guild name> (<guild id>). Make sure to authorize your application with the "applications.commands" scope in that guild.

Defined in

projects/framework/src/lib/SapphireClient.ts:172


regexPrefix?

optional regexPrefix: RegExp

The regex prefix, an alternative to a mention or regular prefix to allow creating natural language command messages

Since

1.0.0

Example

/^(hey +)?bot[,! ]/i

// Matches:
// - hey bot,
// - hey bot!
// - hey bot
// - bot,
// - bot!
// - bot

Defined in

projects/framework/src/lib/SapphireClient.ts:87


typing?

optional typing: boolean

Controls whether the bot will automatically appear to be typing when a command is accepted.

Default

false

Defined in

projects/framework/src/lib/SapphireClient.ts:143