Skip to content

Commit

Permalink
feat: add role subscriptions (discordjs#8915)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
almeidx and Jiralite committed Jan 11, 2023
1 parent a941cb6 commit 3a28a61
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/structures/Integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const IntegrationApplication = require('./IntegrationApplication');
* * `twitch`
* * `youtube`
* * `discord`
* * `guild_subscription`
* @typedef {string} IntegrationType
*/

Expand Down
8 changes: 8 additions & 0 deletions src/structures/Role.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5286,7 +5286,7 @@ export interface ImageURLOptions extends Omit<StaticImageURLOptions, 'format'> {
format?: DynamicImageFormat;
}

export type IntegrationType = 'twitch' | 'youtube' | 'discord';
export type IntegrationType = 'twitch' | 'youtube' | 'discord' | 'guild_subscription';

export interface InteractionCollectorOptions<T extends Interaction, Cached extends CacheType = CacheType>
extends CollectorOptions<[T]> {
Expand Down Expand Up @@ -5902,6 +5902,8 @@ export interface RoleTagData {
botId?: Snowflake;
integrationId?: Snowflake;
premiumSubscriberRole?: true;
subscriptionListingId?: Snowflake;
availableForPurchase?: true;
}

export interface SetChannelPositionOptions {
Expand Down

0 comments on commit 3a28a61

Please sign in to comment.