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 1 commit
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
36 changes: 36 additions & 0 deletions packages/core/src/api/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import type {
RESTGetAPIGuildMembersResult,
RESTGetAPIGuildMembersQuery,
RESTGetAPIGuildMembersSearchResult,
RESTGetAPIGuildOnboardingResult,
RESTGetAPIGuildPreviewResult,
RESTGetAPIGuildPruneCountResult,
RESTGetAPIGuildResult,
Expand Down Expand Up @@ -79,6 +80,8 @@ import type {
RESTPostAPIGuildChannelResult,
RESTPostAPIGuildEmojiJSONBody,
RESTPostAPIGuildEmojiResult,
RESTPutAPIGuildOnboardingJSONBody,
RESTPutAPIGuildOnboardingResult,
RESTPostAPIGuildPruneJSONBody,
RESTPostAPIGuildPruneResult,
RESTPostAPIGuildRoleJSONBody,
Expand Down Expand Up @@ -1229,4 +1232,37 @@ export class GuildsAPI {
body,
}) as Promise<RESTPatchAPIGuildVoiceStateCurrentMemberResult>;
}

/**
* Fetches a guild onboarding
*
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-onboarding}
* @param guildId - The id of the guild to fetch the onboarding from
* @param options - The options for fetching the guild onboarding
*/
public async getOnboarding(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.guildOnboarding(guildId), {
signal,
}) as Promise<RESTGetAPIGuildOnboardingResult>;
}
jaw0r3k marked this conversation as resolved.
Show resolved Hide resolved

/**
* 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.patch(Routes.guildOnboarding(guildId), {
reason,
body,
signal,
}) as Promise<RESTPutAPIGuildOnboardingResult>;
}
}