From 0b4058bdd48b74fcd9944dcf4b6f98d5e0bee105 Mon Sep 17 00:00:00 2001 From: Almeida Date: Tue, 10 Jan 2023 21:07:28 +0000 Subject: [PATCH] feat: role subscriptions (#665) --- deno/payloads/v10/channel.ts | 4 ++-- deno/payloads/v10/guild.ts | 20 +++++++++++++++++++- deno/payloads/v10/permissions.ts | 8 ++++++++ deno/payloads/v9/channel.ts | 4 ++-- deno/payloads/v9/guild.ts | 20 +++++++++++++++++++- deno/payloads/v9/permissions.ts | 8 ++++++++ deno/rest/common.ts | 6 +++++- payloads/v10/channel.ts | 4 ++-- payloads/v10/guild.ts | 20 +++++++++++++++++++- payloads/v10/permissions.ts | 8 ++++++++ payloads/v9/channel.ts | 4 ++-- payloads/v9/guild.ts | 20 +++++++++++++++++++- payloads/v9/permissions.ts | 8 ++++++++ rest/common.ts | 6 +++++- 14 files changed, 126 insertions(+), 14 deletions(-) diff --git a/deno/payloads/v10/channel.ts b/deno/payloads/v10/channel.ts index 5cdd0178..c7bb61af 100644 --- a/deno/payloads/v10/channel.ts +++ b/deno/payloads/v10/channel.ts @@ -689,8 +689,8 @@ export enum MessageType { GuildInviteReminder, ContextMenuCommand, AutoModerationAction, - - InteractionPremiumUpsell = 26, + RoleSubscriptionPurchase, + InteractionPremiumUpsell, /** * @unstable */ diff --git a/deno/payloads/v10/guild.ts b/deno/payloads/v10/guild.ts index fe7e09f2..a7311fee 100644 --- a/deno/payloads/v10/guild.ts +++ b/deno/payloads/v10/guild.ts @@ -400,6 +400,14 @@ export enum GuildFeature { * Guild can enable welcome screen, Membership Screening and discovery, and receives community updates */ Community = 'COMMUNITY', + /** + * Guild has enabled monetization + */ + CreatorMonetizableProvisional = 'CREATOR_MONETIZABLE_PROVISIONAL', + /** + * Guild has enabled the role subscription promo page + */ + CreatorStorePage = 'CREATOR_STORE_PAGE', /* * Guild has been set as a support server on the App Directory */ @@ -446,6 +454,8 @@ export enum GuildFeature { MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED', /** * Guild has enabled monetization + * + * @unstable This feature is no longer documented by Discord */ MonetizationEnabled = 'MONETIZATION_ENABLED', /** @@ -473,6 +483,14 @@ export enum GuildFeature { * Guild is able to set role icons */ RoleIcons = 'ROLE_ICONS', + /** + * Guild has role subscriptions that can be purchased + */ + RoleSubscriptionsAvailableForPurchase = 'ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE', + /** + * Guild has enabled role subscriptions + */ + RoleSubscriptionsEnabled = 'ROLE_SUBSCRIPTIONS_ENABLED', /** * Guild has enabled ticketed events */ @@ -723,7 +741,7 @@ export interface APIGuildIntegration { scopes?: OAuth2Scopes[]; } -export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord'; +export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord' | 'guild_subscription'; /** * https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors diff --git a/deno/payloads/v10/permissions.ts b/deno/payloads/v10/permissions.ts index c749a6f7..47a3e7a7 100644 --- a/deno/payloads/v10/permissions.ts +++ b/deno/payloads/v10/permissions.ts @@ -72,4 +72,12 @@ export interface APIRoleTags { * The id of the integration this role belongs to */ integration_id?: Snowflake; + /** + * The id of this role's subscription sku and listing + */ + subscription_listing_id?: Snowflake; + /** + * Whether this role is available for purchase + */ + available_for_purchase?: null; } diff --git a/deno/payloads/v9/channel.ts b/deno/payloads/v9/channel.ts index a83ba997..3b5a79f1 100644 --- a/deno/payloads/v9/channel.ts +++ b/deno/payloads/v9/channel.ts @@ -680,8 +680,8 @@ export enum MessageType { GuildInviteReminder, ContextMenuCommand, AutoModerationAction, - - InteractionPremiumUpsell = 26, + RoleSubscriptionPurchase, + InteractionPremiumUpsell, /** * @unstable */ diff --git a/deno/payloads/v9/guild.ts b/deno/payloads/v9/guild.ts index fe7e09f2..a7311fee 100644 --- a/deno/payloads/v9/guild.ts +++ b/deno/payloads/v9/guild.ts @@ -400,6 +400,14 @@ export enum GuildFeature { * Guild can enable welcome screen, Membership Screening and discovery, and receives community updates */ Community = 'COMMUNITY', + /** + * Guild has enabled monetization + */ + CreatorMonetizableProvisional = 'CREATOR_MONETIZABLE_PROVISIONAL', + /** + * Guild has enabled the role subscription promo page + */ + CreatorStorePage = 'CREATOR_STORE_PAGE', /* * Guild has been set as a support server on the App Directory */ @@ -446,6 +454,8 @@ export enum GuildFeature { MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED', /** * Guild has enabled monetization + * + * @unstable This feature is no longer documented by Discord */ MonetizationEnabled = 'MONETIZATION_ENABLED', /** @@ -473,6 +483,14 @@ export enum GuildFeature { * Guild is able to set role icons */ RoleIcons = 'ROLE_ICONS', + /** + * Guild has role subscriptions that can be purchased + */ + RoleSubscriptionsAvailableForPurchase = 'ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE', + /** + * Guild has enabled role subscriptions + */ + RoleSubscriptionsEnabled = 'ROLE_SUBSCRIPTIONS_ENABLED', /** * Guild has enabled ticketed events */ @@ -723,7 +741,7 @@ export interface APIGuildIntegration { scopes?: OAuth2Scopes[]; } -export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord'; +export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord' | 'guild_subscription'; /** * https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors diff --git a/deno/payloads/v9/permissions.ts b/deno/payloads/v9/permissions.ts index c749a6f7..47a3e7a7 100644 --- a/deno/payloads/v9/permissions.ts +++ b/deno/payloads/v9/permissions.ts @@ -72,4 +72,12 @@ export interface APIRoleTags { * The id of the integration this role belongs to */ integration_id?: Snowflake; + /** + * The id of this role's subscription sku and listing + */ + subscription_listing_id?: Snowflake; + /** + * Whether this role is available for purchase + */ + available_for_purchase?: null; } diff --git a/deno/rest/common.ts b/deno/rest/common.ts index 55ebf29e..d3226c13 100644 --- a/deno/rest/common.ts +++ b/deno/rest/common.ts @@ -120,6 +120,8 @@ export enum RESTJSONErrorCodes { BitrateIsTooHighForChannelOfThisType = 30052, + MaximumNumberOfPremiumEmojisReached = 30056, + MaximumNumberOfWebhooksPerGuildReached = 30058, Unauthorized = 40001, @@ -220,7 +222,9 @@ export enum RESTJSONErrorCodes { FailedToResizeAssetBelowTheMinimumSize = 50138, - UploadedFileNotFound = 50146, + CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji = 50144, + CannotConvertBetweenPremiumEmojiAndNormalEmoji, + UploadedFileNotFound, YouDoNotHavePermissionToSendThisSticker = 50600, diff --git a/payloads/v10/channel.ts b/payloads/v10/channel.ts index 3fa8c582..e7c630ed 100644 --- a/payloads/v10/channel.ts +++ b/payloads/v10/channel.ts @@ -689,8 +689,8 @@ export enum MessageType { GuildInviteReminder, ContextMenuCommand, AutoModerationAction, - - InteractionPremiumUpsell = 26, + RoleSubscriptionPurchase, + InteractionPremiumUpsell, /** * @unstable */ diff --git a/payloads/v10/guild.ts b/payloads/v10/guild.ts index 8600ec63..452ccb67 100644 --- a/payloads/v10/guild.ts +++ b/payloads/v10/guild.ts @@ -400,6 +400,14 @@ export enum GuildFeature { * Guild can enable welcome screen, Membership Screening and discovery, and receives community updates */ Community = 'COMMUNITY', + /** + * Guild has enabled monetization + */ + CreatorMonetizableProvisional = 'CREATOR_MONETIZABLE_PROVISIONAL', + /** + * Guild has enabled the role subscription promo page + */ + CreatorStorePage = 'CREATOR_STORE_PAGE', /* * Guild has been set as a support server on the App Directory */ @@ -446,6 +454,8 @@ export enum GuildFeature { MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED', /** * Guild has enabled monetization + * + * @unstable This feature is no longer documented by Discord */ MonetizationEnabled = 'MONETIZATION_ENABLED', /** @@ -473,6 +483,14 @@ export enum GuildFeature { * Guild is able to set role icons */ RoleIcons = 'ROLE_ICONS', + /** + * Guild has role subscriptions that can be purchased + */ + RoleSubscriptionsAvailableForPurchase = 'ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE', + /** + * Guild has enabled role subscriptions + */ + RoleSubscriptionsEnabled = 'ROLE_SUBSCRIPTIONS_ENABLED', /** * Guild has enabled ticketed events */ @@ -723,7 +741,7 @@ export interface APIGuildIntegration { scopes?: OAuth2Scopes[]; } -export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord'; +export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord' | 'guild_subscription'; /** * https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors diff --git a/payloads/v10/permissions.ts b/payloads/v10/permissions.ts index 73916293..51c11752 100644 --- a/payloads/v10/permissions.ts +++ b/payloads/v10/permissions.ts @@ -72,4 +72,12 @@ export interface APIRoleTags { * The id of the integration this role belongs to */ integration_id?: Snowflake; + /** + * The id of this role's subscription sku and listing + */ + subscription_listing_id?: Snowflake; + /** + * Whether this role is available for purchase + */ + available_for_purchase?: null; } diff --git a/payloads/v9/channel.ts b/payloads/v9/channel.ts index b83d7873..52fc795b 100644 --- a/payloads/v9/channel.ts +++ b/payloads/v9/channel.ts @@ -680,8 +680,8 @@ export enum MessageType { GuildInviteReminder, ContextMenuCommand, AutoModerationAction, - - InteractionPremiumUpsell = 26, + RoleSubscriptionPurchase, + InteractionPremiumUpsell, /** * @unstable */ diff --git a/payloads/v9/guild.ts b/payloads/v9/guild.ts index 8600ec63..452ccb67 100644 --- a/payloads/v9/guild.ts +++ b/payloads/v9/guild.ts @@ -400,6 +400,14 @@ export enum GuildFeature { * Guild can enable welcome screen, Membership Screening and discovery, and receives community updates */ Community = 'COMMUNITY', + /** + * Guild has enabled monetization + */ + CreatorMonetizableProvisional = 'CREATOR_MONETIZABLE_PROVISIONAL', + /** + * Guild has enabled the role subscription promo page + */ + CreatorStorePage = 'CREATOR_STORE_PAGE', /* * Guild has been set as a support server on the App Directory */ @@ -446,6 +454,8 @@ export enum GuildFeature { MemberVerificationGateEnabled = 'MEMBER_VERIFICATION_GATE_ENABLED', /** * Guild has enabled monetization + * + * @unstable This feature is no longer documented by Discord */ MonetizationEnabled = 'MONETIZATION_ENABLED', /** @@ -473,6 +483,14 @@ export enum GuildFeature { * Guild is able to set role icons */ RoleIcons = 'ROLE_ICONS', + /** + * Guild has role subscriptions that can be purchased + */ + RoleSubscriptionsAvailableForPurchase = 'ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE', + /** + * Guild has enabled role subscriptions + */ + RoleSubscriptionsEnabled = 'ROLE_SUBSCRIPTIONS_ENABLED', /** * Guild has enabled ticketed events */ @@ -723,7 +741,7 @@ export interface APIGuildIntegration { scopes?: OAuth2Scopes[]; } -export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord'; +export type APIGuildIntegrationType = 'twitch' | 'youtube' | 'discord' | 'guild_subscription'; /** * https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors diff --git a/payloads/v9/permissions.ts b/payloads/v9/permissions.ts index 73916293..51c11752 100644 --- a/payloads/v9/permissions.ts +++ b/payloads/v9/permissions.ts @@ -72,4 +72,12 @@ export interface APIRoleTags { * The id of the integration this role belongs to */ integration_id?: Snowflake; + /** + * The id of this role's subscription sku and listing + */ + subscription_listing_id?: Snowflake; + /** + * Whether this role is available for purchase + */ + available_for_purchase?: null; } diff --git a/rest/common.ts b/rest/common.ts index 55ebf29e..d3226c13 100644 --- a/rest/common.ts +++ b/rest/common.ts @@ -120,6 +120,8 @@ export enum RESTJSONErrorCodes { BitrateIsTooHighForChannelOfThisType = 30052, + MaximumNumberOfPremiumEmojisReached = 30056, + MaximumNumberOfWebhooksPerGuildReached = 30058, Unauthorized = 40001, @@ -220,7 +222,9 @@ export enum RESTJSONErrorCodes { FailedToResizeAssetBelowTheMinimumSize = 50138, - UploadedFileNotFound = 50146, + CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji = 50144, + CannotConvertBetweenPremiumEmojiAndNormalEmoji, + UploadedFileNotFound, YouDoNotHavePermissionToSendThisSticker = 50600,