ScheduledEventManager
ScheduledEventManager ⇐ Base
Represents a Scheduled Event Manager that handles creating, editing, and deleting scheduled events for a guild.
Kind: global class
Extends: Base
- ScheduledEventManager ⇐
Base
- new ScheduledEventManager(client)
- instance
- .cache ⇒
- ._add(events, [guildId], [options]) ⇒
GuildScheduledEvent
|null
- .create([options]) ⇒
Promise
- .edit(event, [options]) ⇒
Promise.<Object>
- .delete(event) ⇒
Promise.<Object>
- .fetch(events, options) ⇒
Promise
- ._fetchId(events, [cache], [force]) ⇒
Promise.<Event>
- static
- .transformOptions(o, [create]) ⇒
Promise.<Object>
- .transformOptions(o, [create]) ⇒
new ScheduledEventManager(client)
Constructs a new instance of the class.
Param | Type | Description |
---|---|---|
client | Client | The 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
Param | Type | Default | Description |
---|---|---|---|
events | string | GuildScheduledEvent | The 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] | boolean | true | Whether to cache the event. |
[options.force] | boolean | false | Whether 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.
Param | Type | Description |
---|---|---|
[options] | Object | The options for the scheduled event. |
[options.reason] | string | The 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.
Param | Type | Description |
---|---|---|
event | string | Object | The ID of the event or the event object itself. |
[options] | Object | The options to update the event with. |
[options.reason] | string | The 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.
Param | Type | Description |
---|---|---|
event | string | Object | The 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.
Param | Type | Description |
---|---|---|
events | any | The events to fetch. Can be an ID, an array of IDs, or an object with query options. |
options | object | The options for fetching the events. |
options.cache | boolean | Whether to cache the fetched events. Default is true. |
options.force | boolean | Whether 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.
Param | Type | Default | Description |
---|---|---|---|
events | string | Event | The ID of the event or the event object itself. | |
[cache] | boolean | true | Whether to cache the fetched event. |
[force] | boolean | false | Whether 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.
Param | Type | Default | Description |
---|---|---|---|
o | Object | The options object to transform. | |
[create] | boolean | false | Indicates whether to transform the options for creating a new object. |