• API Docs
  • Handler
  • Classes
  • SparkClient

SparkClient extends Client<Ready>

new SparkClient(options)
ParameterTypeOptionalDescription
optionsSparkClientOptions-

Properties

public application: If<Ready, ClientApplication, null>

public channels: ChannelManager

public directories: Readonly<SparkClientDirectories>

The directories used for the handler.

public guilds: GuildManager

private logLevel: LogLevel

The log level used by the logger.

public logger: Logger

The logger to be used by the handler. Logger implemented by

public options: Omit<ClientOptions, 'intents'> & { intents: IntentsBitField }

public prefix: string

The prefix used for text commands. Defaults to '!'

public readyTimestamp: If<Ready, number, null>

public rest: REST

public shard: null | ShardClientUtil

public sweepers: Sweepers

public token: If<Ready, string, null | string>

public user: If<Ready, ClientUser, null>

public users: UserManager

public voice: ClientVoiceManager

public ws: WebSocketManager

public static captureRejectionSymbol: (typeof captureRejectionSymbol)

public static captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

public static defaultMaxListeners: number

public static errorMonitor: (typeof errorMonitor)

This symbol shall be used to install a listener for only monitoring

public _censoredToken: null | string

public emojis: BaseGuildEmojiManager

public readyAt: If<Ready, Date, null>

public uptime: If<Ready, number, null>

Methods

public addListener(eventName, listener): SparkClient<Ready>

Alias for

ParameterTypeOptionalDescription
eventNamestring | symbol-
listener(args: Array<any>) => void-

public destroy(): void

public emit(event, args): boolean

ParameterTypeOptionalDescription
eventK-
argsClientEvents[K]-

public eventNames(): Array<string | symbol>

Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or

public fetchGuildPreview(guild): Promise<GuildPreview>

ParameterTypeOptionalDescription
guildGuildResolvable-

public fetchGuildTemplate(template): Promise<GuildTemplate>

ParameterTypeOptionalDescription
templatestring-

public fetchGuildWidget(guild): Promise<Widget>

ParameterTypeOptionalDescription
guildGuildResolvable-

public fetchInvite(invite, options?): Promise<Invite>

ParameterTypeOptionalDescription
invitestring-
optionsClientFetchInviteOptions-

public fetchPremiumStickerPacks(): Promise<Collection<string, StickerPack>>

public fetchSticker(id): Promise<Sticker>

ParameterTypeOptionalDescription
idstring-

public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>

public fetchWebhook(id, token?): Promise<Webhook>

ParameterTypeOptionalDescription
idstring-
tokenstring-

public generateInvite(options?): string

ParameterTypeOptionalDescription
optionsInviteGenerationOptions-

public getMaxListeners(): number

Returns the current max listener value for the

public isReady(): this is Client<true>

public listenerCount(eventName): number

Returns the number of listeners listening to the event named

ParameterTypeOptionalDescription
eventNamestring | symbolThe name of the event being listened for

public listeners(eventName): Array<Function>

Returns a copy of the array of listeners for the event named

ParameterTypeOptionalDescription
eventNamestring | symbol-

public login(token): Promise<string>

Registers the handler and logs into the bot. Usage:

ParameterTypeOptionalDescription
tokenstring-

public off(event, listener): SparkClient<Ready>

ParameterTypeOptionalDescription
eventK-
listener(args: ClientEvents[K]) => Awaitable<void>-

public on(event, listener): SparkClient<Ready>

ParameterTypeOptionalDescription
eventK-
listener(args: ClientEvents[K]) => Awaitable<void>-

public once(event, listener): SparkClient<Ready>

ParameterTypeOptionalDescription
eventK-
listener(args: ClientEvents[K]) => Awaitable<void>-

public prependListener(eventName, listener): SparkClient<Ready>

Adds the

ParameterTypeOptionalDescription
eventNamestring | symbolThe name of the event.
listener(args: Array<any>) => voidThe callback function

public prependOnceListener(eventName, listener): SparkClient<Ready>

Adds a one-time

ParameterTypeOptionalDescription
eventNamestring | symbolThe name of the event.
listener(args: Array<any>) => voidThe callback function

public rawListeners(eventName): Array<Function>

Returns a copy of the array of listeners for the event named

ParameterTypeOptionalDescription
eventNamestring | symbol-

public removeAllListeners(event?): SparkClient<Ready>

ParameterTypeOptionalDescription
eventK-

public removeListener(eventName, listener): SparkClient<Ready>

Removes the specified

ParameterTypeOptionalDescription
eventNamestring | symbol-
listener(args: Array<any>) => void-

public setMaxListeners(n): SparkClient<Ready>

By default

ParameterTypeOptionalDescription
nnumber-

public toJSON(): unknown

public static getEventListeners(emitter, name): Array<Function>

Returns a copy of the array of listeners for the event named

ParameterTypeOptionalDescription
emitterEventEmitter | _DOMEventTarget-
namestring | symbol-

public static listenerCount(emitter, eventName): number

A class method that returns the number of listeners for the given

  • ⚠️ Deprecated
ParameterTypeOptionalDescription
emitterEventEmitterThe emitter to query
eventNamestring | symbolThe event name

public static on(emitter, eventName, options?): AsyncIterableIterator<any>

const { on, EventEmitter } = require('events');
 
(async () => {
const ee = new EventEmitter();
 
// Emit later on
process.nextTick(() => {
ee.emit('foo', 'bar');
ee.emit('foo', 42);
});
 
for await (const event of on(ee, 'foo')) {
// The execution of this inner block is synchronous and it
// processes one event at a time (even with await). Do not use
// if concurrent execution is required.
console.log(event); // prints ['bar'] [42]
}
// Unreachable here
})();
ParameterTypeOptionalDescription
emitterEventEmitter-
eventNamestringThe name of the event being listened for
optionsStaticEventEmitterOptions-

public static once(emitter, eventName, options?): Promise<Array<any>>

Creates a

ParameterTypeOptionalDescription
emitter_NodeEventTarget-
eventNamestring | symbol-
optionsStaticEventEmitterOptions-

public static setMaxListeners(n?, eventTargets): void

const {
setMaxListeners,
EventEmitter
} = require('events');
 
const target = new EventTarget();
const emitter = new EventEmitter();
 
setMaxListeners(5, target, emitter);
ParameterTypeOptionalDescription
nnumberA non-negative number. The maximum number of listeners per
eventTargetsArray<EventEmitter | _DOMEventTarget>-