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(core): Add support for guild onboarding #9649

Closed
wants to merge 2 commits into from
Closed
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
22 changes: 22 additions & 0 deletions packages/core/src/api/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ import {
type RESTPostAPIGuildsMFAResult,
type RESTPostAPIGuildsResult,
type RESTPutAPIGuildBanJSONBody,
type RESTPutAPIGuildOnboardingJSONBody,
type RESTPutAPIGuildOnboardingResult,
type RESTPutAPIGuildTemplateSyncResult,
type Snowflake,
} from 'discord-api-types/v10';
Expand Down Expand Up @@ -1241,4 +1243,24 @@ export class GuildsAPI {
public async getOnboarding(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.guildOnboarding(guildId), { signal }) as Promise<RESTGetAPIGuildOnboardingResult>;
}

/**
* Edits the widget settings for a guild
*
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-onboarding}
* @param guildId - The id of the guild to edit the onboarding settings from
* @param body - The new guild onboarding settings data
* @param options - The options for editing the guild onboarding
*/
public async editOnboarding(
guildId: Snowflake,
body: RESTPutAPIGuildOnboardingJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {},
) {
return this.rest.put(Routes.guildOnboarding(guildId), {
reason,
body,
signal,
}) as Promise<RESTPutAPIGuildOnboardingResult>;
}
}