Skip to content

Commit

Permalink
feat(scheduledevents): add image option (#7436)
Browse files Browse the repository at this point in the history
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Antonio Román <kyradiscord@gmail.com>
  • Loading branch information
3 people committed Feb 12, 2022
1 parent b97aedd commit fbc71ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { GuildScheduledEventEntityType, Routes } = require('discord-api-types/v9'
const CachedManager = require('./CachedManager');
const { TypeError, Error } = require('../errors');
const { GuildScheduledEvent } = require('../structures/GuildScheduledEvent');
const DataResolver = require('../util/DataResolver');

/**
* Manages API methods for GuildScheduledEvents and stores their cache.
Expand Down Expand Up @@ -50,6 +51,7 @@ class GuildScheduledEventManager extends CachedManager {
* @property {GuildScheduledEventEntityMetadataOptions} [entityMetadata] The entity metadata of the
* guild scheduled event
* <warn>This is required if `entityType` is {@link GuildScheduledEventEntityType.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 @@ -77,6 +79,7 @@ class GuildScheduledEventManager extends CachedManager {
scheduledEndTime,
entityMetadata,
reason,
image,
} = options;

let entity_metadata, channel_id;
Expand All @@ -99,6 +102,7 @@ class GuildScheduledEventManager extends CachedManager {
description,
entity_type: entityType,
entity_metadata,
image: image && (await DataResolver.resolveImage(image)),
},
reason,
});
Expand Down Expand Up @@ -171,6 +175,7 @@ class GuildScheduledEventManager extends CachedManager {
* guild scheduled event
* <warn>This can be modified only if `entityType` of the `GuildScheduledEvent` to be edited is
* {@link GuildScheduledEventEntityType.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 @@ -196,6 +201,7 @@ class GuildScheduledEventManager extends CachedManager {
scheduledEndTime,
entityMetadata,
reason,
image,
} = options;

let entity_metadata;
Expand All @@ -215,6 +221,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 packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4338,6 +4338,7 @@ export interface GuildScheduledEventCreateOptions {
description?: string;
channel?: GuildVoiceChannelResolvable;
entityMetadata?: GuildScheduledEventEntityMetadataOptions;
image?: BufferResolvable | Base64Resolvable | null;
reason?: string;
}

Expand Down

0 comments on commit fbc71ef

Please sign in to comment.