Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -2138,8 +2138,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