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(StageInstanceManager): add guildScheduledEvent to create() #8885

Merged
merged 3 commits into from
Sep 28, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/discord.js/src/managers/StageInstanceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand Down Expand Up @@ -59,14 +61,17 @@ 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;
const { guildScheduledEvent, topic, privacyLevel, sendStartNotification } = options;

const guildScheduledEventId = guildScheduledEvent && this.resolveId(guildScheduledEvent);

const data = await this.client.rest.post(Routes.stageInstances(), {
body: {
channel_id: channelId,
topic,
privacy_level: privacyLevel,
send_start_notification: sendStartNotification,
guild_scheduled_event_id: guildScheduledEventId,
},
});

Expand Down
1 change: 1 addition & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5214,6 +5214,7 @@ export interface StageInstanceCreateOptions {
topic: string;
privacyLevel?: StageInstancePrivacyLevel;
sendStartNotification?: boolean;
guildScheduledEvent?: GuildScheduledEventResolvable;
}

export interface CrosspostedChannel {
Expand Down