Skip to main content

Interface: SapphireClientOptions

Defined in: projects/framework/src/lib/SapphireClient.ts:40

Properties

baseUserDirectory?

optional baseUserDirectory: null | string | URL

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

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

caseInsensitiveCommands?

optional caseInsensitiveCommands: null | boolean

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

Whether commands can be case-insensitive

Since

1.0.0

Default

false

caseInsensitivePrefixes?

optional caseInsensitivePrefixes: null | boolean

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

Whether prefixes can be case-insensitive

Since

1.0.0

Default

false

defaultCooldown?

optional defaultCooldown: CooldownOptions

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

Sets the default cooldown time for all commands.

Default

"No cooldown options"

defaultPrefix?

optional defaultPrefix: SapphirePrefix

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

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

Since

1.0.0

Default

null

disableMentionPrefix?

optional disableMentionPrefix: boolean

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

Controls whether the bot has mention as a prefix disabled

Default

false

enableLoaderTraceLoggings?

optional enableLoaderTraceLoggings: boolean

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

Whether trace logging should be enabled.

Since

2.0.0

Default

container.logger.has(LogLevel.Trace)

fetchPrefix?

optional fetchPrefix: SapphirePrefixHook

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

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

Since

1.0.0

Default

() => client.options.defaultPrefix

id?

optional id: string

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

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

Since

1.0.0

Default

this.client.user?.id ?? null

loadApplicationCommandRegistriesStatusListeners?

optional loadApplicationCommandRegistriesStatusListeners: boolean

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

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

loadDefaultErrorListeners?

optional loadDefaultErrorListeners: boolean

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

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

loadMessageCommandListeners?

optional loadMessageCommandListeners: boolean

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

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

logger?

optional logger: ClientLoggerOptions

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

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) }

preventFailedToFetchLogForGuilds?

optional preventFailedToFetchLogForGuilds: true | string[]

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

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.


regexPrefix?

optional regexPrefix: RegExp

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

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

typing?

optional typing: boolean

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

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

Default

false