Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(StageInstanceManager): add guildScheduledEvent to create() (#…
…9024)

* Update StageInstanceManager.js

* typings

* docs

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
  • Loading branch information
jaw0r3k and Jiralite committed Oct 3, 2023
1 parent 759c0b0 commit 5f6a82d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/managers/StageInstanceManager.js
Expand Up @@ -32,6 +32,8 @@ class StageInstanceManager extends CachedManager {
* @property {string} topic The topic of the stage instance
* @property {PrivacyLevel|number} [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
*/

/**
Expand Down Expand Up @@ -59,16 +61,18 @@ class StageInstanceManager extends CachedManager {
const channelId = this.guild.channels.resolveId(channel);
if (!channelId) throw new Error('STAGE_CHANNEL_RESOLVE');
if (typeof options !== 'object') throw new TypeError('INVALID_TYPE', 'options', 'object', true);
let { topic, privacyLevel, sendStartNotification } = options;
let { guildScheduledEvent, topic, privacyLevel, sendStartNotification } = options;

privacyLevel &&= typeof privacyLevel === 'number' ? privacyLevel : PrivacyLevels[privacyLevel];
const guildScheduledEventId = guildScheduledEvent && this.resolveId(guildScheduledEvent);

const data = await this.client.api['stage-instances'].post({
data: {
channel_id: channelId,
topic,
privacy_level: privacyLevel,
send_start_notification: sendStartNotification,
guild_scheduled_event_id: guildScheduledEventId,
},
});

Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -4966,6 +4966,7 @@ export interface StageInstanceCreateOptions {
topic: string;
privacyLevel?: PrivacyLevel | number;
sendStartNotification?: boolean;
guildScheduledEvent?: GuildScheduledEventResolvable;
}

export interface CrosspostedChannel {
Expand Down

0 comments on commit 5f6a82d

Please sign in to comment.