Skip to content

Commit

Permalink
feat(scheduledevents): add image option (v13) (#7549)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjammingKirby committed Feb 26, 2022
1 parent f096069 commit 2fcf8af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/managers/GuildScheduledEventManager.js
Expand Up @@ -5,6 +5,7 @@ const CachedManager = require('./CachedManager');
const { TypeError, Error } = require('../errors');
const { GuildScheduledEvent } = require('../structures/GuildScheduledEvent');
const { PrivacyLevels, GuildScheduledEventEntityTypes, GuildScheduledEventStatuses } = require('../util/Constants');
const DataResolver = require('../util/DataResolver');

/**
* Manages API methods for GuildScheduledEvents and stores their cache.
Expand Down Expand Up @@ -49,6 +50,7 @@ class GuildScheduledEventManager extends CachedManager {
* @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the
* guild scheduled event
* <warn>This is required if `entityType` is 'EXTERNAL'</warn>
* @property {?(BufferResolvable|Base64Resolvable)} [image] The cover image of the guild scheduled event
* @property {string} [reason] The reason for creating the guild scheduled event
*/

Expand Down Expand Up @@ -76,6 +78,7 @@ class GuildScheduledEventManager extends CachedManager {
scheduledEndTime,
entityMetadata,
reason,
image,
} = options;

if (typeof privacyLevel === 'string') privacyLevel = PrivacyLevels[privacyLevel];
Expand All @@ -99,6 +102,7 @@ class GuildScheduledEventManager extends CachedManager {
scheduled_start_time: new Date(scheduledStartTime).toISOString(),
scheduled_end_time: scheduledEndTime ? new Date(scheduledEndTime).toISOString() : scheduledEndTime,
description,
image: image && (await DataResolver.resolveImage(image)),
entity_type: entityType,
entity_metadata,
},
Expand Down Expand Up @@ -172,6 +176,7 @@ class GuildScheduledEventManager extends CachedManager {
* @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the
* guild scheduled event
* <warn>This can be modified only if `entityType` of the `GuildScheduledEvent` to be edited is 'EXTERNAL'</warn>
* @property {?(BufferResolvable|Base64Resolvable)} [image] The cover image of the guild scheduled event
* @property {string} [reason] The reason for editing the guild scheduled event
*/

Expand All @@ -197,6 +202,7 @@ class GuildScheduledEventManager extends CachedManager {
scheduledEndTime,
entityMetadata,
reason,
image,
} = options;

if (typeof privacyLevel === 'string') privacyLevel = PrivacyLevels[privacyLevel];
Expand All @@ -220,6 +226,7 @@ class GuildScheduledEventManager extends CachedManager {
description,
entity_type: entityType,
status,
image: image && (await DataResolver.resolveImage(image)),
entity_metadata,
},
reason,
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -4790,6 +4790,7 @@ export interface GuildScheduledEventCreateOptions {
description?: string;
channel?: GuildVoiceChannelResolvable;
entityMetadata?: GuildScheduledEventEntityMetadataOptions;
image?: BufferResolvable | Base64Resolvable | null;
reason?: string;
}

Expand Down

0 comments on commit 2fcf8af

Please sign in to comment.