diff --git a/packages/discord.js/src/client/Client.js b/packages/discord.js/src/client/Client.js index fae1d932a5ab..1e159c961039 100644 --- a/packages/discord.js/src/client/Client.js +++ b/packages/discord.js/src/client/Client.js @@ -543,3 +543,8 @@ module.exports = Client; * @external ImageURLOptions * @see {@link https://discord.js.org/#/docs/rest/main/typedef/ImageURLOptions} */ + +/** + * @external BaseImageURLOptions + * @see {@link https://discord.js.org/#/docs/rest/main/typedef/BaseImageURLOptions} + */ diff --git a/packages/discord.js/src/structures/GuildScheduledEvent.js b/packages/discord.js/src/structures/GuildScheduledEvent.js index 769a0a5318ed..b082ed3ed9ba 100644 --- a/packages/discord.js/src/structures/GuildScheduledEvent.js +++ b/packages/discord.js/src/structures/GuildScheduledEvent.js @@ -152,6 +152,21 @@ class GuildScheduledEvent extends Base { } else { this.entityMetadata ??= null; } + + /** + * The cover image hash for this scheduled event + * @type {?string} + */ + this.image = data.image ?? null; + } + + /** + * The URL of this scheduled event's cover image + * @param {BaseImageURLOptions} [options={}] Options for image URL + * @returns {?string} + */ + coverImageURL(options = {}) { + return this.image && this.client.rest.cdn.guildScheduledEventCover(this.id, this.image, options); } /** diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 065928d1e047..53673db29607 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -26,7 +26,7 @@ import { userMention, } from '@discordjs/builders'; import { Collection } from '@discordjs/collection'; -import { ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest'; +import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest'; import { APIActionRowComponent, APIApplicationCommand, @@ -1160,6 +1160,8 @@ export class GuildScheduledEvent): string | null; public createInviteURL(options?: CreateGuildScheduledEventInviteURLOptions): Promise; public edit>( options: GuildScheduledEventEditOptions,