feat v13(StageInstanceManager): add guildScheduledEvent to create()

#9024 djs
This commit is contained in:
Elysia 2023-02-05 14:58:59 +07:00
parent 9ba2c5e0d9
commit cee3b55f59
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

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