mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
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>
This commit is contained in:
@@ -16,6 +16,7 @@ const IntegrationApplication = require('./IntegrationApplication');
|
||||
* * `twitch`
|
||||
* * `youtube`
|
||||
* * `discord`
|
||||
* * `guild_subscription`
|
||||
* @typedef {string} IntegrationType
|
||||
*/
|
||||
|
||||
|
||||
@@ -107,6 +107,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) {
|
||||
@@ -119,6 +121,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
packages/discord.js/typings/index.d.ts
vendored
4
packages/discord.js/typings/index.d.ts
vendored
@@ -5585,7 +5585,7 @@ export interface IntegrationAccount {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type IntegrationType = 'twitch' | 'youtube' | 'discord';
|
||||
export type IntegrationType = 'twitch' | 'youtube' | 'discord' | 'guild_subscription';
|
||||
|
||||
export type CollectedInteraction<Cached extends CacheType = CacheType> =
|
||||
| StringSelectMenuInteraction<Cached>
|
||||
@@ -6030,6 +6030,8 @@ export interface RoleTagData {
|
||||
botId?: Snowflake;
|
||||
integrationId?: Snowflake;
|
||||
premiumSubscriberRole?: true;
|
||||
subscriptionListingId?: Snowflake;
|
||||
availableForPurchase?: true;
|
||||
}
|
||||
|
||||
export interface SetChannelPositionOptions {
|
||||
|
||||
Reference in New Issue
Block a user