feat(StageInstance): Add support for associated guild event (#7576)

This commit is contained in:
Suneet Tipirneni
2022-03-10 02:57:41 -05:00
committed by GitHub
parent cbdb408dff
commit 3dff31f63f
2 changed files with 21 additions and 0 deletions

View File

@@ -63,6 +63,16 @@ class StageInstance extends Base {
} else {
this.discoverableDisabled ??= null;
}
if ('guild_scheduled_event_id' in data) {
/**
* The associated guild scheduled event id of this stage instance
* @type {?Snowflake}
*/
this.guildScheduledEventId = data.guild_scheduled_event_id;
} else {
this.guildScheduledEventId ??= null;
}
}
/**
@@ -83,6 +93,15 @@ class StageInstance extends Base {
return this.client.guilds.resolve(this.guildId);
}
/**
* The associated guild scheduled event of this stage instance
* @type {?GuildScheduledEvent}
* @readonly
*/
get guildScheduledEvent() {
return this.guild?.scheduledEvents.resolve(this.guildScheduledEventId) ?? null;
}
/**
* Edits this stage instance.
* @param {StageInstanceEditOptions} options The options to edit the stage instance

View File

@@ -2106,8 +2106,10 @@ export class StageInstance extends Base {
public privacyLevel: StageInstancePrivacyLevel;
/** @deprecated See https://github.com/discord/discord-api-docs/pull/4296 for more information */
public discoverableDisabled: boolean | null;
public guildScheduledEventId?: Snowflake;
public get channel(): StageChannel | null;
public get guild(): Guild | null;
public get guildScheduledEvent(): GuildScheduledEvent | null;
public edit(options: StageInstanceEditOptions): Promise<StageInstance>;
public delete(): Promise<StageInstance>;
public setTopic(topic: string): Promise<StageInstance>;