From eced39cc3fa305e336d5752827812cb790ac485d Mon Sep 17 00:00:00 2001 From: Almeida Date: Wed, 14 Jun 2023 13:12:08 +0100 Subject: [PATCH] feat: guild onboarding (#713) --- deno/payloads/v10/guild.ts | 97 +++++++++++++++++++++++++++++++++++++- deno/payloads/v9/guild.ts | 97 +++++++++++++++++++++++++++++++++++++- deno/rest/v10/guild.ts | 6 +++ deno/rest/v10/mod.ts | 8 ++++ deno/rest/v9/guild.ts | 6 +++ deno/rest/v9/mod.ts | 8 ++++ payloads/v10/guild.ts | 97 +++++++++++++++++++++++++++++++++++++- payloads/v9/guild.ts | 97 +++++++++++++++++++++++++++++++++++++- rest/v10/guild.ts | 6 +++ rest/v10/index.ts | 8 ++++ rest/v9/guild.ts | 6 +++ rest/v9/index.ts | 8 ++++ 12 files changed, 440 insertions(+), 4 deletions(-) diff --git a/deno/payloads/v10/guild.ts b/deno/payloads/v10/guild.ts index 4a51ca8f..e1a257eb 100644 --- a/deno/payloads/v10/guild.ts +++ b/deno/payloads/v10/guild.ts @@ -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'; @@ -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, +} diff --git a/deno/payloads/v9/guild.ts b/deno/payloads/v9/guild.ts index dfa2faa5..9dcab251 100644 --- a/deno/payloads/v9/guild.ts +++ b/deno/payloads/v9/guild.ts @@ -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'; @@ -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, +} diff --git a/deno/rest/v10/guild.ts b/deno/rest/v10/guild.ts index 58575a6a..208fd887 100644 --- a/deno/rest/v10/guild.ts +++ b/deno/rest/v10/guild.ts @@ -9,6 +9,7 @@ import type { APIGuildIntegration, APIGuildMember, APIGuildMembershipScreening, + APIGuildOnboarding, APIGuildPreview, APIGuildWelcomeScreen, APIGuildWidget, @@ -916,3 +917,8 @@ export type RESTPatchAPIGuildWelcomeScreenJSONBody = Nullable