mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
feat(scheduledevent): add support for event cover images (#7337)
This commit is contained in:
@@ -543,3 +543,8 @@ module.exports = Client;
|
|||||||
* @external ImageURLOptions
|
* @external ImageURLOptions
|
||||||
* @see {@link https://discord.js.org/#/docs/rest/main/typedef/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}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -152,6 +152,21 @@ class GuildScheduledEvent extends Base {
|
|||||||
} else {
|
} else {
|
||||||
this.entityMetadata ??= null;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
4
packages/discord.js/typings/index.d.ts
vendored
4
packages/discord.js/typings/index.d.ts
vendored
@@ -26,7 +26,7 @@ import {
|
|||||||
userMention,
|
userMention,
|
||||||
} from '@discordjs/builders';
|
} from '@discordjs/builders';
|
||||||
import { Collection } from '@discordjs/collection';
|
import { Collection } from '@discordjs/collection';
|
||||||
import { ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest';
|
import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest';
|
||||||
import {
|
import {
|
||||||
APIActionRowComponent,
|
APIActionRowComponent,
|
||||||
APIApplicationCommand,
|
APIApplicationCommand,
|
||||||
@@ -1160,6 +1160,8 @@ export class GuildScheduledEvent<S extends GuildScheduledEventStatus = GuildSche
|
|||||||
public readonly channel: VoiceChannel | StageChannel | null;
|
public readonly channel: VoiceChannel | StageChannel | null;
|
||||||
public readonly guild: Guild | null;
|
public readonly guild: Guild | null;
|
||||||
public readonly url: string;
|
public readonly url: string;
|
||||||
|
public readonly image: string | null;
|
||||||
|
public coverImageURL(options?: Readonly<BaseImageURLOptions>): string | null;
|
||||||
public createInviteURL(options?: CreateGuildScheduledEventInviteURLOptions): Promise<string>;
|
public createInviteURL(options?: CreateGuildScheduledEventInviteURLOptions): Promise<string>;
|
||||||
public edit<T extends GuildScheduledEventSetStatusArg<S>>(
|
public edit<T extends GuildScheduledEventSetStatusArg<S>>(
|
||||||
options: GuildScheduledEventEditOptions<S, T>,
|
options: GuildScheduledEventEditOptions<S, T>,
|
||||||
|
|||||||
Reference in New Issue
Block a user