feat(StageInstanceManager): add guildScheduledEvent to create() (#9024)

* Update StageInstanceManager.js

* typings

* docs

---------

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
Jaw0r3k 2023-10-03 20:31:19 +02:00 committed by GitHub
parent 759c0b0d46
commit 5f6a82d349
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -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
*/
/**
@ -59,9 +61,10 @@ 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: {
@ -69,6 +72,7 @@ class StageInstanceManager extends CachedManager {
topic,
privacy_level: privacyLevel,
send_start_notification: sendStartNotification,
guild_scheduled_event_id: guildScheduledEventId,
},
});

1
typings/index.d.ts vendored
View file

@ -4966,6 +4966,7 @@ export interface StageInstanceCreateOptions {
topic: string;
privacyLevel?: PrivacyLevel | number;
sendStartNotification?: boolean;
guildScheduledEvent?: GuildScheduledEventResolvable;
}
export interface CrosspostedChannel {