Skip to content

Commit

Permalink
feat(StageInstance): add support for associated guild event (#7713)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Apr 12, 2022
1 parent ab6c2ba commit 68498a8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/structures/StageInstance.js
Expand Up @@ -72,6 +72,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;
}
}

/**
Expand All @@ -83,6 +93,15 @@ class StageInstance extends Base {
return this.client.channels.resolve(this.channelId);
}

/**
* The associated guild scheduled event of this stage instance
* @type {?GuildScheduledEvent}
* @readonly
*/
get guildScheduledEvent() {
return this.guild?.scheduledEvents.resolve(this.guildScheduledEventId) ?? null;
}

/**
* Whether or not the stage instance has been deleted
* @type {boolean}
Expand Down
2 changes: 2 additions & 0 deletions typings/index.d.ts
Expand Up @@ -2246,8 +2246,10 @@ export class StageInstance extends Base {
public topic: string;
public privacyLevel: PrivacyLevel;
public discoverableDisabled: boolean | null;
public guildScheduledEventId?: Snowflake;
public readonly channel: StageChannel | null;
public readonly guild: Guild | null;
public get guildScheduledEvent(): GuildScheduledEvent | null;
public edit(options: StageInstanceEditOptions): Promise<StageInstance>;
public delete(): Promise<StageInstance>;
public setTopic(topic: string): Promise<StageInstance>;
Expand Down

0 comments on commit 68498a8

Please sign in to comment.