feat: role subscriptions (#9040)

* feat: add role subscriptions (#8915)

* feat: add role subscriptions

* docs: casing

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* chore: version 13 specific things

---------

Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
Jiralite
2023-02-17 22:12:47 +00:00
committed by GitHub
parent eed293f893
commit 0afa405f5a
6 changed files with 33 additions and 4 deletions

View File

@@ -228,9 +228,12 @@ class Guild extends AnonymousGuild {
/**
* An array of enabled guild features, here are the possible values:
* * ANIMATED_ICON
* * AUTO_MODERATION
* * BANNER
* * COMMERCE
* * COMMUNITY
* * CREATOR_MONETIZABLE_PROVISIONAL
* * CREATOR_STORE_PAGE
* * DISCOVERABLE
* * FEATURABLE
* * INVITES_DISABLED
@@ -245,12 +248,15 @@ class Guild extends AnonymousGuild {
* * WELCOME_SCREEN_ENABLED
* * TICKETED_EVENTS_ENABLED
* * MONETIZATION_ENABLED
* <warn>`MONETIZATION_ENABLED` has been replaced.
* See [this pull request](https://github.com/discord/discord-api-docs/pull/5724) for more information.</warn>
* * MORE_STICKERS
* * THREE_DAY_THREAD_ARCHIVE
* * SEVEN_DAY_THREAD_ARCHIVE
* * PRIVATE_THREADS
* * ROLE_ICONS
* * AUTO_MODERATION
* * ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE
* * ROLE_SUBSCRIPTIONS_ENABLED
* @typedef {string} Features
* @see {@link https://discord.com/developers/docs/resources/guild#guild-object-guild-features}
*/

View File

@@ -15,6 +15,7 @@ const IntegrationApplication = require('./IntegrationApplication');
* * `twitch`
* * `youtube`
* * `discord`
* * `guild_subscription`
* @typedef {string} IntegrationType
*/

View File

@@ -117,6 +117,8 @@ class Role extends Base {
* @property {Snowflake} [botId] The id of the bot this role belongs to
* @property {Snowflake|string} [integrationId] The id of the integration this role belongs to
* @property {true} [premiumSubscriberRole] Whether this is the guild's premium subscription role
* @property {Snowflake} [subscriptionListingId] The id of this role's subscription SKU and listing
* @property {true} [availableForPurchase] Whether this role is available for purchase
*/
this.tags = data.tags ? {} : null;
if (data.tags) {
@@ -129,6 +131,12 @@ class Role extends Base {
if ('premium_subscriber' in data.tags) {
this.tags.premiumSubscriberRole = true;
}
if ('subscription_listing_id' in data.tags) {
this.tags.subscriptionListingId = data.tags.subscription_listing_id;
}
if ('available_for_purchase' in data.tags) {
this.tags.availableForPurchase = true;
}
}
}