Skip to content

Commit

Permalink
feat: role subscriptions (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Jan 10, 2023
1 parent 1951564 commit 0b4058b
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 14 deletions.
4 changes: 2 additions & 2 deletions deno/payloads/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,8 @@ export enum MessageType {
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,

InteractionPremiumUpsell = 26,
RoleSubscriptionPurchase,
InteractionPremiumUpsell,
/**
* @unstable
*/
Expand Down
20 changes: 19 additions & 1 deletion deno/payloads/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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',
/**
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions deno/payloads/v10/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions deno/payloads/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,8 @@ export enum MessageType {
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,

InteractionPremiumUpsell = 26,
RoleSubscriptionPurchase,
InteractionPremiumUpsell,
/**
* @unstable
*/
Expand Down
20 changes: 19 additions & 1 deletion deno/payloads/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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',
/**
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions deno/payloads/v9/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 5 additions & 1 deletion deno/rest/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export enum RESTJSONErrorCodes {

BitrateIsTooHighForChannelOfThisType = 30052,

MaximumNumberOfPremiumEmojisReached = 30056,

MaximumNumberOfWebhooksPerGuildReached = 30058,

Unauthorized = 40001,
Expand Down Expand Up @@ -220,7 +222,9 @@ export enum RESTJSONErrorCodes {

FailedToResizeAssetBelowTheMinimumSize = 50138,

UploadedFileNotFound = 50146,
CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji = 50144,
CannotConvertBetweenPremiumEmojiAndNormalEmoji,
UploadedFileNotFound,

YouDoNotHavePermissionToSendThisSticker = 50600,

Expand Down
4 changes: 2 additions & 2 deletions payloads/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,8 @@ export enum MessageType {
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,

InteractionPremiumUpsell = 26,
RoleSubscriptionPurchase,
InteractionPremiumUpsell,
/**
* @unstable
*/
Expand Down
20 changes: 19 additions & 1 deletion payloads/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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',
/**
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions payloads/v10/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions payloads/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,8 @@ export enum MessageType {
GuildInviteReminder,
ContextMenuCommand,
AutoModerationAction,

InteractionPremiumUpsell = 26,
RoleSubscriptionPurchase,
InteractionPremiumUpsell,
/**
* @unstable
*/
Expand Down
20 changes: 19 additions & 1 deletion payloads/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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',
/**
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions payloads/v9/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 5 additions & 1 deletion rest/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export enum RESTJSONErrorCodes {

BitrateIsTooHighForChannelOfThisType = 30052,

MaximumNumberOfPremiumEmojisReached = 30056,

MaximumNumberOfWebhooksPerGuildReached = 30058,

Unauthorized = 40001,
Expand Down Expand Up @@ -220,7 +222,9 @@ export enum RESTJSONErrorCodes {

FailedToResizeAssetBelowTheMinimumSize = 50138,

UploadedFileNotFound = 50146,
CannotMixSubscriptionAndNonSubscriptionRolesForAnEmoji = 50144,
CannotConvertBetweenPremiumEmojiAndNormalEmoji,
UploadedFileNotFound,

YouDoNotHavePermissionToSendThisSticker = 50600,

Expand Down

1 comment on commit 0b4058b

@vercel
Copy link

@vercel vercel bot commented on 0b4058b Jan 10, 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.