@zygout/eris 0.19.0 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +71 -80
  3. package/esm.mjs +72 -72
  4. package/index.d.ts +4407 -4397
  5. package/index.js +75 -75
  6. package/lib/Client.js +4708 -4683
  7. package/lib/Constants.d.ts +990 -988
  8. package/lib/Constants.js +1163 -1161
  9. package/lib/command/Command.js +552 -552
  10. package/lib/command/CommandClient.js +460 -460
  11. package/lib/errors/DiscordHTTPError.js +63 -63
  12. package/lib/errors/DiscordRESTError.js +77 -77
  13. package/lib/gateway/Shard.js +3029 -3029
  14. package/lib/gateway/ShardManager.js +164 -164
  15. package/lib/rest/Endpoints.js +172 -172
  16. package/lib/rest/RequestHandler.js +459 -459
  17. package/lib/structures/ApplicationCommand.js +125 -125
  18. package/lib/structures/AutoModerationRule.js +143 -143
  19. package/lib/structures/AutocompleteInteraction.js +80 -80
  20. package/lib/structures/Base.js +81 -81
  21. package/lib/structures/CategoryChannel.js +77 -77
  22. package/lib/structures/Channel.js +98 -98
  23. package/lib/structures/CommandInteraction.js +473 -473
  24. package/lib/structures/ComponentInteraction.js +538 -538
  25. package/lib/structures/DMChannel.js +278 -278
  26. package/lib/structures/Entitlement.js +77 -77
  27. package/lib/structures/ExtendedUser.js +46 -46
  28. package/lib/structures/ForumChannel.js +24 -24
  29. package/lib/structures/GroupChannel.js +106 -106
  30. package/lib/structures/Guild.js +1677 -1677
  31. package/lib/structures/GuildAuditLogEntry.js +190 -190
  32. package/lib/structures/GuildChannel.js +128 -128
  33. package/lib/structures/GuildIntegration.js +99 -99
  34. package/lib/structures/GuildPreview.js +97 -97
  35. package/lib/structures/GuildScheduledEvent.js +176 -176
  36. package/lib/structures/GuildTemplate.js +76 -76
  37. package/lib/structures/GuildTextableChannel.js +260 -260
  38. package/lib/structures/Interaction.js +133 -133
  39. package/lib/structures/Invite.js +143 -143
  40. package/lib/structures/Lobby.js +108 -108
  41. package/lib/structures/LobbyMember.js +59 -59
  42. package/lib/structures/MediaChannel.js +216 -216
  43. package/lib/structures/Member.js +371 -371
  44. package/lib/structures/Message.js +708 -708
  45. package/lib/structures/ModalSubmitInteraction.js +478 -478
  46. package/lib/structures/NewsChannel.js +34 -34
  47. package/lib/structures/NewsThreadChannel.js +12 -12
  48. package/lib/structures/Permission.js +80 -80
  49. package/lib/structures/PermissionOverwrite.js +32 -32
  50. package/lib/structures/PingInteraction.js +39 -39
  51. package/lib/structures/PrivateThreadChannel.js +25 -25
  52. package/lib/structures/PublicThreadChannel.js +26 -26
  53. package/lib/structures/Role.js +163 -163
  54. package/lib/structures/SKU.js +80 -80
  55. package/lib/structures/SoundboardSound.js +79 -79
  56. package/lib/structures/StageChannel.js +59 -59
  57. package/lib/structures/StageInstance.js +55 -55
  58. package/lib/structures/Subscription.js +69 -69
  59. package/lib/structures/TextChannel.js +202 -202
  60. package/lib/structures/ThreadChannel.js +143 -143
  61. package/lib/structures/ThreadMember.js +59 -59
  62. package/lib/structures/UnavailableGuild.js +26 -26
  63. package/lib/structures/UnknownInteraction.js +502 -502
  64. package/lib/structures/User.js +296 -296
  65. package/lib/structures/VoiceChannel.js +166 -166
  66. package/lib/structures/VoiceState.js +84 -84
  67. package/lib/util/BrowserWebSocket.js +76 -76
  68. package/lib/util/Bucket.js +89 -89
  69. package/lib/util/Collection.js +202 -202
  70. package/lib/util/MultipartData.js +70 -70
  71. package/lib/util/Opus.js +33 -33
  72. package/lib/util/SequentialBucket.js +83 -83
  73. package/lib/util/emitDeprecation.js +26 -26
  74. package/lib/voice/Piper.js +300 -300
  75. package/lib/voice/SharedStream.js +238 -238
  76. package/lib/voice/VoiceConnection.js +1440 -1440
  77. package/lib/voice/VoiceConnectionManager.js +151 -151
  78. package/lib/voice/VoiceDataStream.js +22 -22
  79. package/lib/voice/streams/BaseTransformer.js +40 -40
  80. package/lib/voice/streams/DCAOpusTransformer.js +78 -78
  81. package/lib/voice/streams/FFmpegDuplex.js +192 -192
  82. package/lib/voice/streams/FFmpegOggTransformer.js +35 -35
  83. package/lib/voice/streams/FFmpegPCMTransformer.js +26 -26
  84. package/lib/voice/streams/OggOpusTransformer.js +108 -108
  85. package/lib/voice/streams/PCMOpusTransformer.js +61 -61
  86. package/lib/voice/streams/VolumeTransformer.js +50 -50
  87. package/lib/voice/streams/WebmOpusTransformer.js +258 -258
  88. package/package.json +83 -82
@@ -1,163 +1,163 @@
1
- "use strict";
2
-
3
- const Base = require("./Base");
4
- const Endpoints = require("../rest/Endpoints");
5
- const Permission = require("./Permission");
6
-
7
- /**
8
- * Represents a role
9
- * @prop {Number} color The hex color of the role in base 10
10
- * @prop {Object} colors The role's colors
11
- * @prop {Number} colors.primaryColor The primary color of the role
12
- * @prop {Number?} colors.secondaryColor The secondary color of the role (for gradient roles)
13
- * @prop {Number?} colors.tertiaryColor The tertiary color of the role (for holographic roles)
14
- * @prop {Number} createdAt Timestamp of the role's creation
15
- * @prop {Number} flags The flags of the role (see constants)
16
- * @prop {Guild} guild The guild that owns the role
17
- * @prop {Boolean} hoist Whether users with the role are hoisted in the user list or not
18
- * @prop {String?} icon The hash of the role's icon, or null if no icon
19
- * @prop {String?} iconURL The URL of the role's icon
20
- * @prop {String} id The ID of the role
21
- * @prop {Object} json Generates a JSON representation of the role permissions
22
- * @prop {Boolean} managed Whether a guild integration manages the role or not
23
- * @prop {String} mention A string that mentions the role
24
- * @prop {Boolean} mentionable Whether the role is mentionable or not
25
- * @prop {String} name The name of the role
26
- * @prop {Permission} permissions The permissions representation of the role
27
- * @prop {Number} position The position of the role
28
- * @prop {Object?} tags The tags of the role
29
- * @prop {String?} tags.bot_id The ID of the bot associated with the role
30
- * @prop {String?} tags.integration_id The ID of the integration associated with the role
31
- * @prop {Boolean?} tags.premium_subscriber Whether the role is the guild's premium subscriber role
32
- * @prop {String?} tags.subscription_listing_id The id of the role's subscription sku and listing
33
- * @prop {Boolean?} tags.available_for_purchase Whether the role is available for purchase
34
- * @prop {Boolean?} tags.guild_connections Whether the role is a guild's linked role
35
- * @prop {String?} unicodeEmoji Unicode emoji for the role
36
- */
37
- class Role extends Base {
38
- constructor(data, guild) {
39
- super(data.id);
40
- this.guild = guild; // REVIEW Should really consider changing this to client
41
- this.update(data);
42
- }
43
-
44
- update(data) {
45
- if (data.name !== undefined) {
46
- this.name = data.name;
47
- }
48
- if (data.mentionable !== undefined) {
49
- this.mentionable = data.mentionable;
50
- }
51
- if (data.managed !== undefined) {
52
- this.managed = data.managed;
53
- }
54
- if (data.hoist !== undefined) {
55
- this.hoist = data.hoist;
56
- }
57
- if (data.color !== undefined) {
58
- this.color = data.color;
59
- }
60
- if (data.colors !== undefined) {
61
- this.colors = {
62
- primaryColor: data.colors.primary_color,
63
- secondaryColor: data.colors.secondary_color,
64
- tertiaryColor: data.colors.tertiary_color,
65
- };
66
- }
67
- if (data.position !== undefined) {
68
- this.position = data.position;
69
- }
70
- if (data.permissions !== undefined) {
71
- this.permissions = new Permission(data.permissions);
72
- }
73
- if (data.tags !== undefined) {
74
- this.tags = data.tags;
75
- if (this.tags.available_for_purchase === null) {
76
- this.tags.available_for_purchase = true;
77
- } else if (this.tags.guild_connections === null) {
78
- this.tags.guild_connections = true;
79
- } else if (this.tags.premium_subscriber === null) {
80
- this.tags.premium_subscriber = true;
81
- }
82
- }
83
- if (data.icon !== undefined) {
84
- this.icon = data.icon;
85
- }
86
- if (data.unicode_emoji !== undefined) {
87
- this.unicodeEmoji = data.unicode_emoji;
88
- }
89
- if (data.flags !== undefined) {
90
- this.flags = data.flags;
91
- }
92
- }
93
-
94
- get iconURL() {
95
- return this.icon ? this.guild.shard.client._formatImage(Endpoints.ROLE_ICON(this.id, this.icon)) : null;
96
- }
97
-
98
- get json() {
99
- return this.permissions.json;
100
- }
101
-
102
- get mention() {
103
- return `<@&${this.id}>`;
104
- }
105
-
106
- /**
107
- * Delete the role
108
- * @arg {String} [reason] The reason to be displayed in audit logs
109
- * @returns {Promise}
110
- */
111
- delete(reason) {
112
- return this.guild.shard.client.deleteRole.call(this.guild.shard.client, this.guild.id, this.id, reason);
113
- }
114
-
115
- /**
116
- * Edit the guild role
117
- * @arg {Object} options The properties to edit
118
- * @arg {Number} [options.color] The hex color of the role, in number form (ex: 0x3da5b3 or 4040115)
119
- * @arg {Object} [options.colors] The role's colors
120
- * @arg {Number} [options.colors.primaryColor] The primary color of the role
121
- * @arg {Number?} [options.colors.secondaryColor] The secondary color of the role (for gradient roles)
122
- * @arg {Number?} [options.colors.tertiaryColor] The tertiary color of the role (for holographic roles)
123
- * @arg {Boolean} [options.hoist] Whether to hoist the role in the user list or not
124
- * @arg {String} [options.icon] The role icon as a base64 data URI
125
- * @arg {Boolean} [options.mentionable] Whether the role is mentionable or not
126
- * @arg {String} [options.name] The name of the role
127
- * @arg {BigInt | Number} [options.permissions] The role permissions number
128
- * @arg {String?} [options.unicodeEmoji] The role's unicode emoji
129
- * @arg {String} [reason] The reason to be displayed in audit logs
130
- * @returns {Promise<Role>}
131
- */
132
- edit(options, reason) {
133
- return this.guild.shard.client.editRole.call(this.guild.shard.client, this.guild.id, this.id, options, reason);
134
- }
135
-
136
- /**
137
- * Edit the role's position. Note that role position numbers are highest on top and lowest at the bottom.
138
- * @arg {Number} position The new position of the role
139
- * @returns {Promise}
140
- */
141
- editPosition(position) {
142
- return this.guild.shard.client.editRolePosition.call(this.guild.shard.client, this.guild.id, this.id, position);
143
- }
144
-
145
- toJSON(props = []) {
146
- return super.toJSON([
147
- "color",
148
- "colors",
149
- "hoist",
150
- "icon",
151
- "managed",
152
- "mentionable",
153
- "name",
154
- "permissions",
155
- "position",
156
- "tags",
157
- "unicodeEmoji",
158
- ...props,
159
- ]);
160
- }
161
- }
162
-
163
- module.exports = Role;
1
+ "use strict";
2
+
3
+ const Base = require("./Base");
4
+ const Endpoints = require("../rest/Endpoints");
5
+ const Permission = require("./Permission");
6
+
7
+ /**
8
+ * Represents a role
9
+ * @prop {Number} color The hex color of the role in base 10
10
+ * @prop {Object} colors The role's colors
11
+ * @prop {Number} colors.primaryColor The primary color of the role
12
+ * @prop {Number?} colors.secondaryColor The secondary color of the role (for gradient roles)
13
+ * @prop {Number?} colors.tertiaryColor The tertiary color of the role (for holographic roles)
14
+ * @prop {Number} createdAt Timestamp of the role's creation
15
+ * @prop {Number} flags The flags of the role (see constants)
16
+ * @prop {Guild} guild The guild that owns the role
17
+ * @prop {Boolean} hoist Whether users with the role are hoisted in the user list or not
18
+ * @prop {String?} icon The hash of the role's icon, or null if no icon
19
+ * @prop {String?} iconURL The URL of the role's icon
20
+ * @prop {String} id The ID of the role
21
+ * @prop {Object} json Generates a JSON representation of the role permissions
22
+ * @prop {Boolean} managed Whether a guild integration manages the role or not
23
+ * @prop {String} mention A string that mentions the role
24
+ * @prop {Boolean} mentionable Whether the role is mentionable or not
25
+ * @prop {String} name The name of the role
26
+ * @prop {Permission} permissions The permissions representation of the role
27
+ * @prop {Number} position The position of the role
28
+ * @prop {Object?} tags The tags of the role
29
+ * @prop {String?} tags.bot_id The ID of the bot associated with the role
30
+ * @prop {String?} tags.integration_id The ID of the integration associated with the role
31
+ * @prop {Boolean?} tags.premium_subscriber Whether the role is the guild's premium subscriber role
32
+ * @prop {String?} tags.subscription_listing_id The id of the role's subscription sku and listing
33
+ * @prop {Boolean?} tags.available_for_purchase Whether the role is available for purchase
34
+ * @prop {Boolean?} tags.guild_connections Whether the role is a guild's linked role
35
+ * @prop {String?} unicodeEmoji Unicode emoji for the role
36
+ */
37
+ class Role extends Base {
38
+ constructor(data, guild) {
39
+ super(data.id);
40
+ this.guild = guild; // REVIEW Should really consider changing this to client
41
+ this.update(data);
42
+ }
43
+
44
+ update(data) {
45
+ if (data.name !== undefined) {
46
+ this.name = data.name;
47
+ }
48
+ if (data.mentionable !== undefined) {
49
+ this.mentionable = data.mentionable;
50
+ }
51
+ if (data.managed !== undefined) {
52
+ this.managed = data.managed;
53
+ }
54
+ if (data.hoist !== undefined) {
55
+ this.hoist = data.hoist;
56
+ }
57
+ if (data.color !== undefined) {
58
+ this.color = data.color;
59
+ }
60
+ if (data.colors !== undefined) {
61
+ this.colors = {
62
+ primaryColor: data.colors.primary_color,
63
+ secondaryColor: data.colors.secondary_color,
64
+ tertiaryColor: data.colors.tertiary_color,
65
+ };
66
+ }
67
+ if (data.position !== undefined) {
68
+ this.position = data.position;
69
+ }
70
+ if (data.permissions !== undefined) {
71
+ this.permissions = new Permission(data.permissions);
72
+ }
73
+ if (data.tags !== undefined) {
74
+ this.tags = data.tags;
75
+ if (this.tags.available_for_purchase === null) {
76
+ this.tags.available_for_purchase = true;
77
+ } else if (this.tags.guild_connections === null) {
78
+ this.tags.guild_connections = true;
79
+ } else if (this.tags.premium_subscriber === null) {
80
+ this.tags.premium_subscriber = true;
81
+ }
82
+ }
83
+ if (data.icon !== undefined) {
84
+ this.icon = data.icon;
85
+ }
86
+ if (data.unicode_emoji !== undefined) {
87
+ this.unicodeEmoji = data.unicode_emoji;
88
+ }
89
+ if (data.flags !== undefined) {
90
+ this.flags = data.flags;
91
+ }
92
+ }
93
+
94
+ get iconURL() {
95
+ return this.icon ? this.guild.shard.client._formatImage(Endpoints.ROLE_ICON(this.id, this.icon)) : null;
96
+ }
97
+
98
+ get json() {
99
+ return this.permissions.json;
100
+ }
101
+
102
+ get mention() {
103
+ return `<@&${this.id}>`;
104
+ }
105
+
106
+ /**
107
+ * Delete the role
108
+ * @arg {String} [reason] The reason to be displayed in audit logs
109
+ * @returns {Promise}
110
+ */
111
+ delete(reason) {
112
+ return this.guild.shard.client.deleteRole.call(this.guild.shard.client, this.guild.id, this.id, reason);
113
+ }
114
+
115
+ /**
116
+ * Edit the guild role
117
+ * @arg {Object} options The properties to edit
118
+ * @arg {Number} [options.color] The hex color of the role, in number form (ex: 0x3da5b3 or 4040115)
119
+ * @arg {Object} [options.colors] The role's colors
120
+ * @arg {Number} [options.colors.primaryColor] The primary color of the role
121
+ * @arg {Number?} [options.colors.secondaryColor] The secondary color of the role (for gradient roles)
122
+ * @arg {Number?} [options.colors.tertiaryColor] The tertiary color of the role (for holographic roles)
123
+ * @arg {Boolean} [options.hoist] Whether to hoist the role in the user list or not
124
+ * @arg {String} [options.icon] The role icon as a base64 data URI
125
+ * @arg {Boolean} [options.mentionable] Whether the role is mentionable or not
126
+ * @arg {String} [options.name] The name of the role
127
+ * @arg {BigInt | Number} [options.permissions] The role permissions number
128
+ * @arg {String?} [options.unicodeEmoji] The role's unicode emoji
129
+ * @arg {String} [reason] The reason to be displayed in audit logs
130
+ * @returns {Promise<Role>}
131
+ */
132
+ edit(options, reason) {
133
+ return this.guild.shard.client.editRole.call(this.guild.shard.client, this.guild.id, this.id, options, reason);
134
+ }
135
+
136
+ /**
137
+ * Edit the role's position. Note that role position numbers are highest on top and lowest at the bottom.
138
+ * @arg {Number} position The new position of the role
139
+ * @returns {Promise}
140
+ */
141
+ editPosition(position) {
142
+ return this.guild.shard.client.editRolePosition.call(this.guild.shard.client, this.guild.id, this.id, position);
143
+ }
144
+
145
+ toJSON(props = []) {
146
+ return super.toJSON([
147
+ "color",
148
+ "colors",
149
+ "hoist",
150
+ "icon",
151
+ "managed",
152
+ "mentionable",
153
+ "name",
154
+ "permissions",
155
+ "position",
156
+ "tags",
157
+ "unicodeEmoji",
158
+ ...props,
159
+ ]);
160
+ }
161
+ }
162
+
163
+ module.exports = Role;
@@ -1,80 +1,80 @@
1
- "use strict";
2
-
3
- const Base = require("./Base");
4
-
5
- /**
6
- * Represents a SKU (premium offering of an application)
7
- * @prop {String} applicationID The ID of the parent application
8
- * @prop {Number} flags The SKU flags combined as a bitfield. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/sku#sku-object-sku-flags) for a list of flags
9
- * @prop {String} id The ID of the SKU
10
- * @prop {String} name The customer-facing name of the SKU
11
- * @prop {String} slug The system-generated URL slug based on the SKU's name
12
- * @prop {Number} type The type of the SKU. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/sku#sku-object-sku-types) for a list of types
13
- */
14
- class SKU extends Base {
15
- constructor(data, client) {
16
- super(data.id);
17
- this._client = client;
18
- this.applicationID = data.application_id;
19
- this.flags = data.flags;
20
- this.name = data.name;
21
- this.slug = data.slug;
22
- this.type = data.type;
23
- }
24
-
25
- /**
26
- * Create a test entitlement for this SKU
27
- * @arg {String} ownerID The ID of the guild or user to grant the entitlement to
28
- * @arg {Number} ownerType The type of the owner. `1` for a guild, `2` for a user
29
- * @returns {Promise<Entitlement>}
30
- */
31
- createTestEntitlement(ownerID, ownerType) {
32
- return this._client.createTestEntitlement.call(this._client, {
33
- ownerID: ownerID,
34
- ownerType: ownerType,
35
- skuID: this.id,
36
- });
37
- }
38
-
39
- /**
40
- * Get the entitlements for this SKU
41
- * @arg {Object} [options] Options for the request. See `Client#getEntitlements` for the full list of options (`skuIDs` is ignored)
42
- * @returns {Promise<Array<Entitlement>>}
43
- */
44
- getEntitlements(options = {}) {
45
- return this._client.getEntitlements.call(this._client, Object.assign({}, options, {
46
- skuIDs: [this.id],
47
- }));
48
- }
49
-
50
- /**
51
- * Get a subscription to this SKU
52
- * @arg {String} subscriptionID The ID of the subscription
53
- * @returns {Promise<Subscription>}
54
- */
55
- getSKUSubscription(subscriptionID) {
56
- return this._client.getSKUSubscription.call(this._client, this.id, subscriptionID);
57
- }
58
-
59
- /**
60
- * Get the subscriptions to this SKU
61
- * @arg {Object} options Options for the request. See `Client#getSKUSubscriptions` for the full list of options
62
- * @returns {Promise<Array<Subscription>>}
63
- */
64
- getSKUSubscriptions(options) {
65
- return this._client.getSKUSubscriptions.call(this._client, this.id, options);
66
- }
67
-
68
- toJSON(props = []) {
69
- return super.toJSON([
70
- "applicationID",
71
- "flags",
72
- "name",
73
- "slug",
74
- "type",
75
- ...props,
76
- ]);
77
- }
78
- }
79
-
80
- module.exports = SKU;
1
+ "use strict";
2
+
3
+ const Base = require("./Base");
4
+
5
+ /**
6
+ * Represents a SKU (premium offering of an application)
7
+ * @prop {String} applicationID The ID of the parent application
8
+ * @prop {Number} flags The SKU flags combined as a bitfield. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/sku#sku-object-sku-flags) for a list of flags
9
+ * @prop {String} id The ID of the SKU
10
+ * @prop {String} name The customer-facing name of the SKU
11
+ * @prop {String} slug The system-generated URL slug based on the SKU's name
12
+ * @prop {Number} type The type of the SKU. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/sku#sku-object-sku-types) for a list of types
13
+ */
14
+ class SKU extends Base {
15
+ constructor(data, client) {
16
+ super(data.id);
17
+ this._client = client;
18
+ this.applicationID = data.application_id;
19
+ this.flags = data.flags;
20
+ this.name = data.name;
21
+ this.slug = data.slug;
22
+ this.type = data.type;
23
+ }
24
+
25
+ /**
26
+ * Create a test entitlement for this SKU
27
+ * @arg {String} ownerID The ID of the guild or user to grant the entitlement to
28
+ * @arg {Number} ownerType The type of the owner. `1` for a guild, `2` for a user
29
+ * @returns {Promise<Entitlement>}
30
+ */
31
+ createTestEntitlement(ownerID, ownerType) {
32
+ return this._client.createTestEntitlement.call(this._client, {
33
+ ownerID: ownerID,
34
+ ownerType: ownerType,
35
+ skuID: this.id,
36
+ });
37
+ }
38
+
39
+ /**
40
+ * Get the entitlements for this SKU
41
+ * @arg {Object} [options] Options for the request. See `Client#getEntitlements` for the full list of options (`skuIDs` is ignored)
42
+ * @returns {Promise<Array<Entitlement>>}
43
+ */
44
+ getEntitlements(options = {}) {
45
+ return this._client.getEntitlements.call(this._client, Object.assign({}, options, {
46
+ skuIDs: [this.id],
47
+ }));
48
+ }
49
+
50
+ /**
51
+ * Get a subscription to this SKU
52
+ * @arg {String} subscriptionID The ID of the subscription
53
+ * @returns {Promise<Subscription>}
54
+ */
55
+ getSKUSubscription(subscriptionID) {
56
+ return this._client.getSKUSubscription.call(this._client, this.id, subscriptionID);
57
+ }
58
+
59
+ /**
60
+ * Get the subscriptions to this SKU
61
+ * @arg {Object} options Options for the request. See `Client#getSKUSubscriptions` for the full list of options
62
+ * @returns {Promise<Array<Subscription>>}
63
+ */
64
+ getSKUSubscriptions(options) {
65
+ return this._client.getSKUSubscriptions.call(this._client, this.id, options);
66
+ }
67
+
68
+ toJSON(props = []) {
69
+ return super.toJSON([
70
+ "applicationID",
71
+ "flags",
72
+ "name",
73
+ "slug",
74
+ "type",
75
+ ...props,
76
+ ]);
77
+ }
78
+ }
79
+
80
+ module.exports = SKU;
@@ -1,79 +1,79 @@
1
- "use strict";
2
-
3
- const Base = require("./Base");
4
-
5
- /**
6
- * Represents a Soundboard Sound
7
- * @prop {Boolean} available Whether the soundboard sound is available or not (will always be true for default soundboard sounds)
8
- * @prop {String?} emojiID The ID of the relating custom emoji (will always be null for default soundboard sounds)
9
- * @prop {String?} emojiName The name mof the relating default emoji
10
- * @prop {Guild?} guild The guild where the soundboard sound was created in (not present for default soundboard sounds). If the guild is uncached, this will be an object with an `id` key. No other keys are guaranteed
11
- * @prop {String} id The ID of the soundboard sound
12
- * @prop {String} name The name of the soundboard sound
13
- * @prop {User?} user The user that created the soundboard sound (not present for default soundboard sounds, or if the bot doesn't have either create/editGuildExpressions permissions)
14
- * @prop {Number} volume The volume of the soundboard sound, between 0 and 1
15
- */
16
- class SoundboardSound extends Base {
17
- constructor(data, client) {
18
- super(data.id);
19
- this._client = client;
20
- if (data.guild_id !== undefined) {
21
- this.guild = client.guilds.get(data.guild_id) || { id: data.guild_id };
22
- }
23
- }
24
-
25
- update(data) {
26
- if (data.name !== undefined) {
27
- this.name = data.name;
28
- }
29
- if (data.volume !== undefined) {
30
- this.volume = data.volume;
31
- }
32
- if (data.emoji_id !== undefined) {
33
- this.emojiID = data.emoji_id;
34
- }
35
- if (data.emoji_name !== undefined) {
36
- this.emojiName = data.emoji_name;
37
- }
38
- if (data.available !== undefined) {
39
- this.available = data.available;
40
- }
41
- if (data.user !== undefined) {
42
- this.user = this._client.users.update(data.user, this._client);
43
- }
44
- }
45
-
46
- /**
47
- * Delete the soundboard sound (not available for default soundboard sounds)
48
- * @arg {String} [reason] The reason to be displayed in audit logs
49
- * @returns {Promise}
50
- */
51
- delete(reason) {
52
- return this._client.deleteGuildSoundboardSound.call(this._client, this.guild.id, this.id, reason);
53
- }
54
-
55
- /**
56
- * Edit the soundboard sound (not available for default soundboard sounds)
57
- * @arg {Object} options The properties to edit
58
- * @arg {String?} [options.emojiID] The ID of the relating custom emoji (mutually exclusive with options.emojiName)
59
- * @arg {String?} [options.emojiName] The name of the relating default emoji (mutually exclusive with options.emojiID)
60
- * @arg {String} [options.name] The name of the soundboard sound (2-32 characters)
61
- * @arg {Number?} [options.volume] The volume of the soundboard sound, between 0 and 1
62
- * @arg {String} [options.reason] The reason to be displayed in audit logs
63
- * @returns {Promise<SoundboardSound>}
64
- */
65
- edit(options) {
66
- return this._client.editGuildSoundboardSound.call(this._client, this.guild.id, this.id, options);
67
- }
68
-
69
- /**
70
- * Send the soundboard sound to a connected voice channel
71
- * @arg {String} channelID The ID of the connected voice channel
72
- * @returns {Promise}
73
- */
74
- send(channelID) {
75
- return this._client.sendSoundboardSound.call(this._client, channelID, { soundID: this.id, sourceGuildID: this.guild.id });
76
- }
77
- }
78
-
79
- module.exports = SoundboardSound;
1
+ "use strict";
2
+
3
+ const Base = require("./Base");
4
+
5
+ /**
6
+ * Represents a Soundboard Sound
7
+ * @prop {Boolean} available Whether the soundboard sound is available or not (will always be true for default soundboard sounds)
8
+ * @prop {String?} emojiID The ID of the relating custom emoji (will always be null for default soundboard sounds)
9
+ * @prop {String?} emojiName The name mof the relating default emoji
10
+ * @prop {Guild?} guild The guild where the soundboard sound was created in (not present for default soundboard sounds). If the guild is uncached, this will be an object with an `id` key. No other keys are guaranteed
11
+ * @prop {String} id The ID of the soundboard sound
12
+ * @prop {String} name The name of the soundboard sound
13
+ * @prop {User?} user The user that created the soundboard sound (not present for default soundboard sounds, or if the bot doesn't have either create/editGuildExpressions permissions)
14
+ * @prop {Number} volume The volume of the soundboard sound, between 0 and 1
15
+ */
16
+ class SoundboardSound extends Base {
17
+ constructor(data, client) {
18
+ super(data.id);
19
+ this._client = client;
20
+ if (data.guild_id !== undefined) {
21
+ this.guild = client.guilds.get(data.guild_id) || { id: data.guild_id };
22
+ }
23
+ }
24
+
25
+ update(data) {
26
+ if (data.name !== undefined) {
27
+ this.name = data.name;
28
+ }
29
+ if (data.volume !== undefined) {
30
+ this.volume = data.volume;
31
+ }
32
+ if (data.emoji_id !== undefined) {
33
+ this.emojiID = data.emoji_id;
34
+ }
35
+ if (data.emoji_name !== undefined) {
36
+ this.emojiName = data.emoji_name;
37
+ }
38
+ if (data.available !== undefined) {
39
+ this.available = data.available;
40
+ }
41
+ if (data.user !== undefined) {
42
+ this.user = this._client.users.update(data.user, this._client);
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Delete the soundboard sound (not available for default soundboard sounds)
48
+ * @arg {String} [reason] The reason to be displayed in audit logs
49
+ * @returns {Promise}
50
+ */
51
+ delete(reason) {
52
+ return this._client.deleteGuildSoundboardSound.call(this._client, this.guild.id, this.id, reason);
53
+ }
54
+
55
+ /**
56
+ * Edit the soundboard sound (not available for default soundboard sounds)
57
+ * @arg {Object} options The properties to edit
58
+ * @arg {String?} [options.emojiID] The ID of the relating custom emoji (mutually exclusive with options.emojiName)
59
+ * @arg {String?} [options.emojiName] The name of the relating default emoji (mutually exclusive with options.emojiID)
60
+ * @arg {String} [options.name] The name of the soundboard sound (2-32 characters)
61
+ * @arg {Number?} [options.volume] The volume of the soundboard sound, between 0 and 1
62
+ * @arg {String} [options.reason] The reason to be displayed in audit logs
63
+ * @returns {Promise<SoundboardSound>}
64
+ */
65
+ edit(options) {
66
+ return this._client.editGuildSoundboardSound.call(this._client, this.guild.id, this.id, options);
67
+ }
68
+
69
+ /**
70
+ * Send the soundboard sound to a connected voice channel
71
+ * @arg {String} channelID The ID of the connected voice channel
72
+ * @returns {Promise}
73
+ */
74
+ send(channelID) {
75
+ return this._client.sendSoundboardSound.call(this._client, channelID, { soundID: this.id, sourceGuildID: this.guild.id });
76
+ }
77
+ }
78
+
79
+ module.exports = SoundboardSound;