Skip to content

Commit

Permalink
feat: support onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
jaw0r3k committed Jun 14, 2023
1 parent 6c2242f commit bf8d73e
Showing 1 changed file with 36 additions and 0 deletions.
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>;
}

/**
* 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 onboarding settings data
* @param options - The options for editing the onboarding
*/
public async editOnboarding(
guildId: Snowflake,
body: RESTPutAPIGuildOnboardingJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {},
) {
return this.rest.patch(Routes.guildWidgetSettings(guildId), {
reason,
body,
signal,
}) as Promise<RESTPutAPIGuildOnboardingResult>;
}
}

0 comments on commit bf8d73e

Please sign in to comment.