feat(scheduledevents): Event cover images for v13 (#7613)

Co-authored-by: Suneet Tipirneni <77477100+suneettipirneni@users.noreply.github.com>
This commit is contained in:
Ben
2022-03-07 12:26:57 -06:00
committed by GitHub
parent 7a52785f7d
commit a7535a2232
3 changed files with 19 additions and 0 deletions

View File

@@ -156,6 +156,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 {StaticImageURLOptions} [options={}] Options for image URL
* @returns {?string}
*/
coverImageURL({ format, size } = {}) {
return this.image && this.client.rest.cdn.guildScheduledEventCover(this.id, this.image, format, size);
}
/**

View File

@@ -77,6 +77,8 @@ exports.Endpoints = {
`${root}/stickers/${stickerId}.${stickerFormat === 'LOTTIE' ? 'json' : 'png'}`,
RoleIcon: (roleId, hash, format = 'webp', size) =>
makeImageUrl(`${root}/role-icons/${roleId}/${hash}`, { size, format }),
guildScheduledEventCover: (scheduledEventId, coverHash, format, size) =>
makeImageUrl(`${root}/guild-events/${scheduledEventId}/${coverHash}`, { size, format }),
};
},
invite: (root, code, eventId) => (eventId ? `${root}/${code}?event=${eventId}` : `${root}/${code}`),

2
typings/index.d.ts vendored
View File

@@ -1187,6 +1187,8 @@ export class GuildScheduledEvent<S extends GuildScheduledEventStatus = GuildSche
public readonly channel: VoiceChannel | StageChannel | null;
public readonly guild: Guild | null;
public readonly url: string;
public readonly image: string | null;
public coverImageURL(options?: StaticImageURLOptions): string | null;
public createInviteURL(options?: CreateGuildScheduledEventInviteURLOptions): Promise<string>;
public edit<T extends GuildScheduledEventSetStatusArg<S>>(
options: GuildScheduledEventEditOptions<S, T>,