Skip to content

Commit a7535a2

Browse files
BenjammingKirbysuneettipirneni
andauthoredMar 7, 2022
feat(scheduledevents): Event cover images for v13 (#7613)
Co-authored-by: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com>
1 parent 7a52785 commit a7535a2

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
 

‎src/structures/GuildScheduledEvent.js

+15
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,21 @@ class GuildScheduledEvent extends Base {
156156
} else {
157157
this.entityMetadata ??= null;
158158
}
159+
160+
/**
161+
* The cover image hash for this scheduled event
162+
* @type {?string}
163+
*/
164+
this.image = data.image ?? null;
165+
}
166+
167+
/**
168+
* The URL of this scheduled event's cover image
169+
* @param {StaticImageURLOptions} [options={}] Options for image URL
170+
* @returns {?string}
171+
*/
172+
coverImageURL({ format, size } = {}) {
173+
return this.image && this.client.rest.cdn.guildScheduledEventCover(this.id, this.image, format, size);
159174
}
160175

161176
/**

‎src/util/Constants.js

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ exports.Endpoints = {
7777
`${root}/stickers/${stickerId}.${stickerFormat === 'LOTTIE' ? 'json' : 'png'}`,
7878
RoleIcon: (roleId, hash, format = 'webp', size) =>
7979
makeImageUrl(`${root}/role-icons/${roleId}/${hash}`, { size, format }),
80+
guildScheduledEventCover: (scheduledEventId, coverHash, format, size) =>
81+
makeImageUrl(`${root}/guild-events/${scheduledEventId}/${coverHash}`, { size, format }),
8082
};
8183
},
8284
invite: (root, code, eventId) => (eventId ? `${root}/${code}?event=${eventId}` : `${root}/${code}`),

‎typings/index.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,8 @@ export class GuildScheduledEvent<S extends GuildScheduledEventStatus = GuildSche
11871187
public readonly channel: VoiceChannel | StageChannel | null;
11881188
public readonly guild: Guild | null;
11891189
public readonly url: string;
1190+
public readonly image: string | null;
1191+
public coverImageURL(options?: StaticImageURLOptions): string | null;
11901192
public createInviteURL(options?: CreateGuildScheduledEventInviteURLOptions): Promise<string>;
11911193
public edit<T extends GuildScheduledEventSetStatusArg<S>>(
11921194
options: GuildScheduledEventEditOptions<S, T>,

0 commit comments

Comments
 (0)
Please sign in to comment.