Skip to content

ScheduledEventManager

ScheduledEventManager ⇐ Base

Represents a Scheduled Event Manager that handles creating, editing, and deleting scheduled events for a guild.

Kind: global class
Extends: Base

new ScheduledEventManager(client)

Constructs a new instance of the class.

ParamTypeDescription
clientClientThe client object used for communication with the server.

scheduledEventManager.cache ⇒

Getter method for the cache property.

Kind: instance property of ScheduledEventManager
Returns: The Collection object representing the cache.

scheduledEventManager._add(events, [guildId], [options]) ⇒ GuildScheduledEvent | null

Adds an event to the guild’s scheduled events.

Kind: instance method of ScheduledEventManager
Returns: GuildScheduledEvent | null - - The added event or null if the events parameter is falsy

ParamTypeDefaultDescription
eventsstring | GuildScheduledEventThe event or event ID to add.
[guildId]string”this.guildId”The ID of the guild to add the event to.
[options]object{cache: true, force: false}Additional options for adding the event.
[options.cache]booleantrueWhether to cache the event.
[options.force]booleanfalseWhether to force adding the event even if it already exists in the cache.

scheduledEventManager.create([options]) ⇒ Promise

Creates a scheduled event with the given options.

Kind: instance method of ScheduledEventManager
Returns: Promise - A promise that resolves with the created event.

ParamTypeDescription
[options]ObjectThe options for the scheduled event.
[options.reason]stringThe reason for creating the event.

scheduledEventManager.edit(event, [options]) ⇒ Promise.<Object>

Edits a scheduled event with the given options.

Kind: instance method of ScheduledEventManager
Returns: Promise.<Object> - A promise that resolves with the updated event object.

ParamTypeDescription
eventstring | ObjectThe ID of the event or the event object itself.
[options]ObjectThe options to update the event with.
[options.reason]stringThe reason for editing the event.

scheduledEventManager.delete(event) ⇒ Promise.<Object>

Deletes an event from the scheduled events of a guild.

Kind: instance method of ScheduledEventManager
Returns: Promise.<Object> - - The deleted event object.

ParamTypeDescription
eventstring | ObjectThe event to be deleted. Can be either the event ID as a string or the event object itself.

scheduledEventManager.fetch(events, options) ⇒ Promise

Fetches scheduled events from the server based on the provided options.

Kind: instance method of ScheduledEventManager
Returns: Promise - A promise that resolves with the fetched events.

ParamTypeDescription
eventsanyThe events to fetch. Can be an ID, an array of IDs, or an object with query options.
optionsobjectThe options for fetching the events.
options.cachebooleanWhether to cache the fetched events. Default is true.
options.forcebooleanWhether to force fetch the events even if they are already cached. Default is false.

scheduledEventManager._fetchId(events, [cache], [force]) ⇒ Promise.<Event>

Fetches the ID of an event from the server.

Kind: instance method of ScheduledEventManager
Returns: Promise.<Event> - - The fetched event.

ParamTypeDefaultDescription
eventsstring | EventThe ID of the event or the event object itself.
[cache]booleantrueWhether to cache the fetched event.
[force]booleanfalseWhether to force fetch the event even if it is already cached.

ScheduledEventManager.transformOptions(o, [create]) ⇒ Promise.<Object>

Transforms the options object into the desired format based on the provided parameters.

Kind: static method of ScheduledEventManager
Returns: Promise.<Object> - - The transformed options object.

ParamTypeDefaultDescription
oObjectThe options object to transform.
[create]booleanfalseIndicates whether to transform the options for creating a new object.