From e7b014252249ff7f56fe4aebd03888877f19f1d6 Mon Sep 17 00:00:00 2001 From: almeidx Date: Wed, 30 Nov 2022 12:30:44 +0000 Subject: [PATCH] feat(StageInstanceManager): add `guildScheduledEvent` to `create()` --- packages/discord.js/src/managers/StageInstanceManager.js | 7 ++++++- packages/discord.js/typings/index.d.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/src/managers/StageInstanceManager.js b/packages/discord.js/src/managers/StageInstanceManager.js index ea037cfe5e99..67c8c1ac4338 100644 --- a/packages/discord.js/src/managers/StageInstanceManager.js +++ b/packages/discord.js/src/managers/StageInstanceManager.js @@ -32,6 +32,8 @@ class StageInstanceManager extends CachedManager { * @property {string} topic The topic of the stage instance * @property {StageInstancePrivacyLevel} [privacyLevel] The privacy level of the stage instance * @property {boolean} [sendStartNotification] Whether to notify `@everyone` that the stage instance has started + * @property {GuildScheduledEventResolvable} [guildScheduledEvent] + * The guild scheduled event associated with the stage instance */ /** @@ -59,7 +61,9 @@ class StageInstanceManager extends CachedManager { const channelId = this.guild.channels.resolveId(channel); if (!channelId) throw new DiscordjsError(ErrorCodes.StageChannelResolve); if (typeof options !== 'object') throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'options', 'object', true); - let { topic, privacyLevel, sendStartNotification } = options; + let { guildScheduledEvent, topic, privacyLevel, sendStartNotification } = options; + + const guildScheduledEventId = guildScheduledEvent && this.resolveId(guildScheduledEvent); const data = await this.client.rest.post(Routes.stageInstances(), { body: { @@ -67,6 +71,7 @@ class StageInstanceManager extends CachedManager { topic, privacy_level: privacyLevel, send_start_notification: sendStartNotification, + guild_scheduled_event_id: guildScheduledEventId ?? undefined, }, }); diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index e1918f124747..6b5512721a24 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -4955,6 +4955,7 @@ export interface StageInstanceCreateOptions { topic: string; privacyLevel?: StageInstancePrivacyLevel; sendStartNotification?: boolean; + guildScheduledEvent?: GuildScheduledEventResolvable; } export interface CrosspostedChannel {