@zygout/eris 0.19.0 → 0.19.1

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 +109 -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,34 +1,34 @@
1
- "use strict";
2
-
3
- const TextChannel = require("./TextChannel");
4
-
5
- /**
6
- * Represents a guild news channel. See TextChannel for more properties and methods
7
- * @extends TextChannel
8
- */
9
- class NewsChannel extends TextChannel {
10
- update(data) {
11
- super.update(data);
12
- }
13
-
14
- /**
15
- * Crosspost (publish) a message to subscribed channels
16
- * @arg {String} messageID The ID of the message
17
- * @returns {Promise<Message>}
18
- */
19
- crosspostMessage(messageID) {
20
- return this._client.crosspostMessage.call(this._client, this.id, messageID);
21
- }
22
-
23
- /**
24
- * Follow this channel in another channel. This creates a webhook in the target channel
25
- * @arg {String} webhookChannelID The ID of the target channel
26
- * @arg {String} [reason] The reason to be displayed in audit logs
27
- * @returns {Object} An object containing this channel's ID and the new webhook's ID
28
- */
29
- follow(webhookChannelID, reason) {
30
- return this._client.followChannel.call(this._client, this.id, webhookChannelID, reason);
31
- }
32
- }
33
-
34
- module.exports = NewsChannel;
1
+ "use strict";
2
+
3
+ const TextChannel = require("./TextChannel");
4
+
5
+ /**
6
+ * Represents a guild news channel. See TextChannel for more properties and methods
7
+ * @extends TextChannel
8
+ */
9
+ class NewsChannel extends TextChannel {
10
+ update(data) {
11
+ super.update(data);
12
+ }
13
+
14
+ /**
15
+ * Crosspost (publish) a message to subscribed channels
16
+ * @arg {String} messageID The ID of the message
17
+ * @returns {Promise<Message>}
18
+ */
19
+ crosspostMessage(messageID) {
20
+ return this._client.crosspostMessage.call(this._client, this.id, messageID);
21
+ }
22
+
23
+ /**
24
+ * Follow this channel in another channel. This creates a webhook in the target channel
25
+ * @arg {String} webhookChannelID The ID of the target channel
26
+ * @arg {String} [reason] The reason to be displayed in audit logs
27
+ * @returns {Object} An object containing this channel's ID and the new webhook's ID
28
+ */
29
+ follow(webhookChannelID, reason) {
30
+ return this._client.followChannel.call(this._client, this.id, webhookChannelID, reason);
31
+ }
32
+ }
33
+
34
+ module.exports = NewsChannel;
@@ -1,12 +1,12 @@
1
- "use strict";
2
-
3
- const ThreadChannel = require("./ThreadChannel");
4
-
5
- /**
6
- * Represents a news thread channel. See ThreadChannel for more properties and methods
7
- * @extends ThreadChannel
8
- */
9
- class NewsThreadChannel extends ThreadChannel {
10
- }
11
-
12
- module.exports = NewsThreadChannel;
1
+ "use strict";
2
+
3
+ const ThreadChannel = require("./ThreadChannel");
4
+
5
+ /**
6
+ * Represents a news thread channel. See ThreadChannel for more properties and methods
7
+ * @extends ThreadChannel
8
+ */
9
+ class NewsThreadChannel extends ThreadChannel {
10
+ }
11
+
12
+ module.exports = NewsThreadChannel;
@@ -1,80 +1,80 @@
1
- "use strict";
2
-
3
- const Base = require("./Base");
4
- const { Permissions } = require("../Constants");
5
-
6
- /**
7
- * Represents a calculated permissions number
8
- * @prop {BigInt} allow The allowed permissions number
9
- * @prop {BigInt} deny The denied permissions number
10
- * @prop {Object} json A JSON representation of the permissions number.
11
- * If a permission key isn't there, it is not set by this permission.
12
- * If a permission key is false, it is denied by the permission.
13
- * If a permission key is true, it is allowed by the permission.
14
- * i.e.:
15
- * {
16
- * "readMessages": true,
17
- * "sendMessages": true,
18
- * "manageMessages": false
19
- * }
20
- * In the above example, readMessages and sendMessages are allowed permissions, and manageMessages is denied. Everything else is not explicitly set.
21
- * [A full list of permission nodes can be found on the docs reference page](/Eris/docs/reference)
22
- */
23
- class Permission extends Base {
24
- constructor(allow, deny = 0) {
25
- super();
26
- if (typeof allow === "object") {
27
- this.update(allow);
28
- } else {
29
- this.allow = BigInt(allow);
30
- this.deny = BigInt(deny);
31
- }
32
- }
33
-
34
- update(data) {
35
- this.allow = BigInt(data.allow);
36
- this.deny = BigInt(data.deny || 0);
37
- }
38
-
39
- get json() {
40
- if (!this._json) {
41
- this._json = {};
42
- for (const perm of Object.keys(Permissions)) {
43
- if (!perm.startsWith("all")) {
44
- if (this.allow & Permissions[perm]) {
45
- this._json[perm] = true;
46
- } else if (this.deny & Permissions[perm]) {
47
- this._json[perm] = false;
48
- }
49
- }
50
- }
51
- }
52
- return this._json;
53
- }
54
-
55
- /**
56
- * Check if this permission allows a specific permission
57
- * @arg {String | BigInt} permission The name of the permission, or bit of permissions. [A full list of permission nodes can be found on the docs reference page](/Eris/docs/reference). Pass a BigInt if you want to check multiple permissions.
58
- * @returns {Boolean} Whether the permission allows the specified permission
59
- */
60
- has(permission) {
61
- if (typeof permission === "bigint") {
62
- return (this.allow & permission) === permission;
63
- }
64
- return !!(this.allow & Permissions[permission]);
65
- }
66
-
67
- toString() {
68
- return `[${this.constructor.name} +${this.allow} -${this.deny}]`;
69
- }
70
-
71
- toJSON(props = []) {
72
- return super.toJSON([
73
- "allow",
74
- "deny",
75
- ...props,
76
- ]);
77
- }
78
- }
79
-
80
- module.exports = Permission;
1
+ "use strict";
2
+
3
+ const Base = require("./Base");
4
+ const { Permissions } = require("../Constants");
5
+
6
+ /**
7
+ * Represents a calculated permissions number
8
+ * @prop {BigInt} allow The allowed permissions number
9
+ * @prop {BigInt} deny The denied permissions number
10
+ * @prop {Object} json A JSON representation of the permissions number.
11
+ * If a permission key isn't there, it is not set by this permission.
12
+ * If a permission key is false, it is denied by the permission.
13
+ * If a permission key is true, it is allowed by the permission.
14
+ * i.e.:
15
+ * {
16
+ * "readMessages": true,
17
+ * "sendMessages": true,
18
+ * "manageMessages": false
19
+ * }
20
+ * In the above example, readMessages and sendMessages are allowed permissions, and manageMessages is denied. Everything else is not explicitly set.
21
+ * [A full list of permission nodes can be found on the docs reference page](/Eris/docs/reference)
22
+ */
23
+ class Permission extends Base {
24
+ constructor(allow, deny = 0) {
25
+ super();
26
+ if (typeof allow === "object") {
27
+ this.update(allow);
28
+ } else {
29
+ this.allow = BigInt(allow);
30
+ this.deny = BigInt(deny);
31
+ }
32
+ }
33
+
34
+ update(data) {
35
+ this.allow = BigInt(data.allow);
36
+ this.deny = BigInt(data.deny || 0);
37
+ }
38
+
39
+ get json() {
40
+ if (!this._json) {
41
+ this._json = {};
42
+ for (const perm of Object.keys(Permissions)) {
43
+ if (!perm.startsWith("all")) {
44
+ if (this.allow & Permissions[perm]) {
45
+ this._json[perm] = true;
46
+ } else if (this.deny & Permissions[perm]) {
47
+ this._json[perm] = false;
48
+ }
49
+ }
50
+ }
51
+ }
52
+ return this._json;
53
+ }
54
+
55
+ /**
56
+ * Check if this permission allows a specific permission
57
+ * @arg {String | BigInt} permission The name of the permission, or bit of permissions. [A full list of permission nodes can be found on the docs reference page](/Eris/docs/reference). Pass a BigInt if you want to check multiple permissions.
58
+ * @returns {Boolean} Whether the permission allows the specified permission
59
+ */
60
+ has(permission) {
61
+ if (typeof permission === "bigint") {
62
+ return (this.allow & permission) === permission;
63
+ }
64
+ return !!(this.allow & Permissions[permission]);
65
+ }
66
+
67
+ toString() {
68
+ return `[${this.constructor.name} +${this.allow} -${this.deny}]`;
69
+ }
70
+
71
+ toJSON(props = []) {
72
+ return super.toJSON([
73
+ "allow",
74
+ "deny",
75
+ ...props,
76
+ ]);
77
+ }
78
+ }
79
+
80
+ module.exports = Permission;
@@ -1,32 +1,32 @@
1
- "use strict";
2
-
3
- const Permission = require("./Permission");
4
-
5
- /**
6
- * Represents a permission overwrite
7
- * @extends Permission
8
- * @prop {String} id The ID of the overwrite
9
- * @prop {Number} type The type of the overwrite, either 1 for "member" or 0 for "role"
10
- */
11
- class PermissionOverwrite extends Permission {
12
- constructor(data) {
13
- super(data.allow, data.deny);
14
- this.id = data.id;
15
- this.type = data.type;
16
-
17
- this.update(data);
18
- }
19
-
20
- update(data) {
21
- super.update(data);
22
- }
23
-
24
- toJSON(props = []) {
25
- return super.toJSON([
26
- "type",
27
- ...props,
28
- ]);
29
- }
30
- }
31
-
32
- module.exports = PermissionOverwrite;
1
+ "use strict";
2
+
3
+ const Permission = require("./Permission");
4
+
5
+ /**
6
+ * Represents a permission overwrite
7
+ * @extends Permission
8
+ * @prop {String} id The ID of the overwrite
9
+ * @prop {Number} type The type of the overwrite, either 1 for "member" or 0 for "role"
10
+ */
11
+ class PermissionOverwrite extends Permission {
12
+ constructor(data) {
13
+ super(data.allow, data.deny);
14
+ this.id = data.id;
15
+ this.type = data.type;
16
+
17
+ this.update(data);
18
+ }
19
+
20
+ update(data) {
21
+ super.update(data);
22
+ }
23
+
24
+ toJSON(props = []) {
25
+ return super.toJSON([
26
+ "type",
27
+ ...props,
28
+ ]);
29
+ }
30
+ }
31
+
32
+ module.exports = PermissionOverwrite;
@@ -1,39 +1,39 @@
1
- "use strict";
2
-
3
- const Interaction = require("./Interaction");
4
- const { InteractionResponseTypes } = require("../Constants");
5
-
6
- /**
7
- * Represents a ping interaction. See Interaction for more properties.
8
- * @extends Interaction
9
- */
10
- class PingInteraction extends Interaction {
11
- constructor(info, client) {
12
- super(info, client);
13
- }
14
-
15
- /**
16
- * Acknowledges the ping interaction with a pong response.
17
- * Note: You can **not** use more than 1 initial interaction response per interaction.
18
- * @returns {Promise}
19
- */
20
- async acknowledge() {
21
- return this.pong();
22
- }
23
-
24
- /**
25
- * Acknowledges the ping interaction with a pong response.
26
- * Note: You can **not** use more than 1 initial interaction response per interaction.
27
- * @returns {Promise}
28
- */
29
- async pong() {
30
- if (this.acknowledged === true) {
31
- throw new Error("You have already acknowledged this interaction.");
32
- }
33
- return this._client.createInteractionResponse.call(this._client, this.id, this.token, {
34
- type: InteractionResponseTypes.PONG,
35
- }).then(() => this.update());
36
- }
37
- }
38
-
39
- module.exports = PingInteraction;
1
+ "use strict";
2
+
3
+ const Interaction = require("./Interaction");
4
+ const { InteractionResponseTypes } = require("../Constants");
5
+
6
+ /**
7
+ * Represents a ping interaction. See Interaction for more properties.
8
+ * @extends Interaction
9
+ */
10
+ class PingInteraction extends Interaction {
11
+ constructor(info, client) {
12
+ super(info, client);
13
+ }
14
+
15
+ /**
16
+ * Acknowledges the ping interaction with a pong response.
17
+ * Note: You can **not** use more than 1 initial interaction response per interaction.
18
+ * @returns {Promise}
19
+ */
20
+ async acknowledge() {
21
+ return this.pong();
22
+ }
23
+
24
+ /**
25
+ * Acknowledges the ping interaction with a pong response.
26
+ * Note: You can **not** use more than 1 initial interaction response per interaction.
27
+ * @returns {Promise}
28
+ */
29
+ async pong() {
30
+ if (this.acknowledged === true) {
31
+ throw new Error("You have already acknowledged this interaction.");
32
+ }
33
+ return this._client.createInteractionResponse.call(this._client, this.id, this.token, {
34
+ type: InteractionResponseTypes.PONG,
35
+ }).then(() => this.update());
36
+ }
37
+ }
38
+
39
+ module.exports = PingInteraction;
@@ -1,25 +1,25 @@
1
- "use strict";
2
-
3
- const ThreadChannel = require("./ThreadChannel");
4
-
5
- /**
6
- * Represents a private thread channel. See ThreadChannel for more properties and methods
7
- * @extends ThreadChannel
8
- * @prop {Object} threadMetadata Metadata for the thread
9
- * @prop {Boolean} threadMetadata.archived Whether the thread is archived or not
10
- * @prop {Number} threadMetadata.archiveTimestamp Timestamp of when the thread's archive status was last changed, used for calculating recent activity
11
- * @prop {Number} threadMetadata.autoArchiveDuration Duration in minutes to automatically hide the thread after recent activity, either 60, 1440, 4320, or 10080
12
- * @prop {Number?} threadMetadata.createTimestamp Timestamp when the thread was created (only available for threads created after 09 January 2022)
13
- * @prop {Boolean} threadMetadata.invitable Whether non-moderators can add other non-moderators to the thread
14
- * @prop {Boolean} threadMetadata.locked Whether the thread is locked or not
15
- */
16
- class PrivateThreadChannel extends ThreadChannel {
17
- update(data) {
18
- super.update(data);
19
- if (data.thread_metadata !== undefined) {
20
- this.threadMetadata.invitable = data.thread_metadata.invitable;
21
- }
22
- }
23
- }
24
-
25
- module.exports = PrivateThreadChannel;
1
+ "use strict";
2
+
3
+ const ThreadChannel = require("./ThreadChannel");
4
+
5
+ /**
6
+ * Represents a private thread channel. See ThreadChannel for more properties and methods
7
+ * @extends ThreadChannel
8
+ * @prop {Object} threadMetadata Metadata for the thread
9
+ * @prop {Boolean} threadMetadata.archived Whether the thread is archived or not
10
+ * @prop {Number} threadMetadata.archiveTimestamp Timestamp of when the thread's archive status was last changed, used for calculating recent activity
11
+ * @prop {Number} threadMetadata.autoArchiveDuration Duration in minutes to automatically hide the thread after recent activity, either 60, 1440, 4320, or 10080
12
+ * @prop {Number?} threadMetadata.createTimestamp Timestamp when the thread was created (only available for threads created after 09 January 2022)
13
+ * @prop {Boolean} threadMetadata.invitable Whether non-moderators can add other non-moderators to the thread
14
+ * @prop {Boolean} threadMetadata.locked Whether the thread is locked or not
15
+ */
16
+ class PrivateThreadChannel extends ThreadChannel {
17
+ update(data) {
18
+ super.update(data);
19
+ if (data.thread_metadata !== undefined) {
20
+ this.threadMetadata.invitable = data.thread_metadata.invitable;
21
+ }
22
+ }
23
+ }
24
+
25
+ module.exports = PrivateThreadChannel;
@@ -1,26 +1,26 @@
1
- "use strict";
2
-
3
- const ThreadChannel = require("./ThreadChannel");
4
-
5
- /**
6
- * Represents a public thread channel. See ThreadChannel for more properties
7
- * @extends ThreadChannel
8
- * @prop {Array<String>?} appliedTags The IDs of the set of tags that have been applied to a thread in a forum/media channel (threads created in forum/media channels only, max 5)
9
- */
10
- class PublicThreadChannel extends ThreadChannel {
11
- update(data) {
12
- super.update(data);
13
- if (data.applied_tags !== undefined) {
14
- this.appliedTags = data.applied_tags;
15
- }
16
- }
17
-
18
- toJSON(props = []) {
19
- super.toJSON([
20
- "appliedTags",
21
- ...props,
22
- ]);
23
- }
24
- }
25
-
26
- module.exports = PublicThreadChannel;
1
+ "use strict";
2
+
3
+ const ThreadChannel = require("./ThreadChannel");
4
+
5
+ /**
6
+ * Represents a public thread channel. See ThreadChannel for more properties
7
+ * @extends ThreadChannel
8
+ * @prop {Array<String>?} appliedTags The IDs of the set of tags that have been applied to a thread in a forum/media channel (threads created in forum/media channels only, max 5)
9
+ */
10
+ class PublicThreadChannel extends ThreadChannel {
11
+ update(data) {
12
+ super.update(data);
13
+ if (data.applied_tags !== undefined) {
14
+ this.appliedTags = data.applied_tags;
15
+ }
16
+ }
17
+
18
+ toJSON(props = []) {
19
+ super.toJSON([
20
+ "appliedTags",
21
+ ...props,
22
+ ]);
23
+ }
24
+ }
25
+
26
+ module.exports = PublicThreadChannel;