Skip to content

Commit

Permalink
feat: guild onboarding (#713)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Jun 14, 2023
1 parent f3fe162 commit eced39c
Show file tree
Hide file tree
Showing 12 changed files with 440 additions and 4 deletions.
97 changes: 96 additions & 1 deletion deno/payloads/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIEmoji } from './emoji.ts';
import type { APIEmoji, APIPartialEmoji } from './emoji.ts';
import type { PresenceUpdateStatus } from './gateway.ts';
import type { OAuth2Scopes } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
Expand Down Expand Up @@ -999,3 +999,98 @@ export enum MembershipScreeningFieldType {
*/
Terms = 'TERMS',
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-guild-onboarding-structure
*/
export interface APIGuildOnboarding {
/**
* Id of the guild this onboarding is part of
*/
guild_id: Snowflake;
/**
* Prompts shown during onboarding and in customize community
*/
prompts: APIGuildOnboardingPrompt[];
/**
* Channel ids that members get opted into automatically
*/
default_channel_ids: Snowflake[];
/**
* Whether onboarding is enabled in the guild
*/
enabled: boolean;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure
*/
export interface APIGuildOnboardingPrompt {
/**
* Id of the prompt
*/
id: Snowflake;
/**
* Options available within the prompt
*/
options: APIGuildOnboardingPromptOption[];
/**
* Title of the prompt
*/
title: string;
/**
* Indicates whether users are limited to selecting one option for the prompt
*/
single_select: boolean;
/**
* Indicates whether the prompt is required before a user completes the onboarding flow
*/
required: boolean;
/**
* Indicates whether the prompt is present in the onboarding flow.
* If `false`, the prompt will only appear in the Channels & Roles tab
*/
in_onboarding: boolean;
/**
* Type of prompt
*/
type: GuildOnboardingPromptType;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure
*/
export interface APIGuildOnboardingPromptOption {
/**
* Id of the prompt option
*/
id: Snowflake;
/**
* Ids for channels a member is added to when the option is selected
*/
channel_ids: Snowflake[];
/**
* Ids for roles assigned to a member when the option is selected
*/
role_ids: Snowflake[];
/**
* Emoji of the option
*/
emoji: APIPartialEmoji;
/**
* Title of the option
*/
title: string;
/**
* Description of the option
*/
description: string | null;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types
*/
export enum GuildOnboardingPromptType {
MultipleChoice,
Dropdown,
}
97 changes: 96 additions & 1 deletion deno/payloads/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import type { Permissions, Snowflake } from '../../globals.ts';
import type { APIEmoji } from './emoji.ts';
import type { APIEmoji, APIPartialEmoji } from './emoji.ts';
import type { PresenceUpdateStatus } from './gateway.ts';
import type { OAuth2Scopes } from './oauth2.ts';
import type { APIRole } from './permissions.ts';
Expand Down Expand Up @@ -991,3 +991,98 @@ export enum MembershipScreeningFieldType {
*/
Terms = 'TERMS',
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-guild-onboarding-structure
*/
export interface APIGuildOnboarding {
/**
* Id of the guild this onboarding is part of
*/
guild_id: Snowflake;
/**
* Prompts shown during onboarding and in customize community
*/
prompts: APIGuildOnboardingPrompt[];
/**
* Channel ids that members get opted into automatically
*/
default_channel_ids: Snowflake[];
/**
* Whether onboarding is enabled in the guild
*/
enabled: boolean;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure
*/
export interface APIGuildOnboardingPrompt {
/**
* Id of the prompt
*/
id: Snowflake;
/**
* Options available within the prompt
*/
options: APIGuildOnboardingPromptOption[];
/**
* Title of the prompt
*/
title: string;
/**
* Indicates whether users are limited to selecting one option for the prompt
*/
single_select: boolean;
/**
* Indicates whether the prompt is required before a user completes the onboarding flow
*/
required: boolean;
/**
* Indicates whether the prompt is present in the onboarding flow.
* If `false`, the prompt will only appear in the Channels & Roles tab
*/
in_onboarding: boolean;
/**
* Type of prompt
*/
type: GuildOnboardingPromptType;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure
*/
export interface APIGuildOnboardingPromptOption {
/**
* Id of the prompt option
*/
id: Snowflake;
/**
* Ids for channels a member is added to when the option is selected
*/
channel_ids: Snowflake[];
/**
* Ids for roles assigned to a member when the option is selected
*/
role_ids: Snowflake[];
/**
* Emoji of the option
*/
emoji: APIPartialEmoji;
/**
* Title of the option
*/
title: string;
/**
* Description of the option
*/
description: string | null;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types
*/
export enum GuildOnboardingPromptType {
MultipleChoice,
Dropdown,
}
6 changes: 6 additions & 0 deletions deno/rest/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
APIGuildIntegration,
APIGuildMember,
APIGuildMembershipScreening,
APIGuildOnboarding,
APIGuildPreview,
APIGuildWelcomeScreen,
APIGuildWidget,
Expand Down Expand Up @@ -916,3 +917,8 @@ export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable<StrictPartial<APIG
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
*/
export type RESTPatchAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;

/**
* https://discord.com/developers/docs/resources/guild#get-guild-onboarding
*/
export type RESTGetAPIGuildOnboardingResult = APIGuildOnboarding;
8 changes: 8 additions & 0 deletions deno/rest/v10/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,14 @@ export const Routes = {
guildScheduledEventUsers(guildId: Snowflake, guildScheduledEventId: Snowflake) {
return `/guilds/${guildId}/scheduled-events/${guildScheduledEventId}/users` as const;
},

/**
* Route for:
* - GET `/guilds/${guild.id}/onboarding`
*/
guildOnboarding(guildId: Snowflake) {
return `/guilds/${guildId}/onboarding` as const;
},
};

export const StickerPackApplicationId = '710982414301790216';
Expand Down
6 changes: 6 additions & 0 deletions deno/rest/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
APIGuildIntegration,
APIGuildMember,
APIGuildMembershipScreening,
APIGuildOnboarding,
APIGuildPreview,
APIGuildWelcomeScreen,
APIGuildWidget,
Expand Down Expand Up @@ -922,3 +923,8 @@ export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable<StrictPartial<APIG
* https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
*/
export type RESTPatchAPIGuildWelcomeScreenResult = APIGuildWelcomeScreen;

/**
* https://discord.com/developers/docs/resources/guild#get-guild-onboarding
*/
export type RESTGetAPIGuildOnboardingResult = APIGuildOnboarding;
8 changes: 8 additions & 0 deletions deno/rest/v9/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,14 @@ export const Routes = {
guildScheduledEventUsers(guildId: Snowflake, guildScheduledEventId: Snowflake) {
return `/guilds/${guildId}/scheduled-events/${guildScheduledEventId}/users` as const;
},

/**
* Route for:
* - GET `/guilds/${guild.id}/onboarding`
*/
guildOnboarding(guildId: Snowflake) {
return `/guilds/${guildId}/onboarding` as const;
},
};

export const StickerPackApplicationId = '710982414301790216';
Expand Down
97 changes: 96 additions & 1 deletion payloads/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import type { Permissions, Snowflake } from '../../globals';
import type { APIEmoji } from './emoji';
import type { APIEmoji, APIPartialEmoji } from './emoji';
import type { PresenceUpdateStatus } from './gateway';
import type { OAuth2Scopes } from './oauth2';
import type { APIRole } from './permissions';
Expand Down Expand Up @@ -999,3 +999,98 @@ export enum MembershipScreeningFieldType {
*/
Terms = 'TERMS',
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-guild-onboarding-structure
*/
export interface APIGuildOnboarding {
/**
* Id of the guild this onboarding is part of
*/
guild_id: Snowflake;
/**
* Prompts shown during onboarding and in customize community
*/
prompts: APIGuildOnboardingPrompt[];
/**
* Channel ids that members get opted into automatically
*/
default_channel_ids: Snowflake[];
/**
* Whether onboarding is enabled in the guild
*/
enabled: boolean;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-onboarding-prompt-structure
*/
export interface APIGuildOnboardingPrompt {
/**
* Id of the prompt
*/
id: Snowflake;
/**
* Options available within the prompt
*/
options: APIGuildOnboardingPromptOption[];
/**
* Title of the prompt
*/
title: string;
/**
* Indicates whether users are limited to selecting one option for the prompt
*/
single_select: boolean;
/**
* Indicates whether the prompt is required before a user completes the onboarding flow
*/
required: boolean;
/**
* Indicates whether the prompt is present in the onboarding flow.
* If `false`, the prompt will only appear in the Channels & Roles tab
*/
in_onboarding: boolean;
/**
* Type of prompt
*/
type: GuildOnboardingPromptType;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-option-structure
*/
export interface APIGuildOnboardingPromptOption {
/**
* Id of the prompt option
*/
id: Snowflake;
/**
* Ids for channels a member is added to when the option is selected
*/
channel_ids: Snowflake[];
/**
* Ids for roles assigned to a member when the option is selected
*/
role_ids: Snowflake[];
/**
* Emoji of the option
*/
emoji: APIPartialEmoji;
/**
* Title of the option
*/
title: string;
/**
* Description of the option
*/
description: string | null;
}

/**
* https://discord.com/developers/docs/resources/guild#guild-onboarding-object-prompt-types
*/
export enum GuildOnboardingPromptType {
MultipleChoice,
Dropdown,
}

1 comment on commit eced39c

@vercel
Copy link

@vercel vercel bot commented on eced39c Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.