@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.
- package/LICENSE +20 -20
- package/README.md +109 -80
- package/esm.mjs +72 -72
- package/index.d.ts +4407 -4397
- package/index.js +75 -75
- package/lib/Client.js +4708 -4683
- package/lib/Constants.d.ts +990 -988
- package/lib/Constants.js +1163 -1161
- package/lib/command/Command.js +552 -552
- package/lib/command/CommandClient.js +460 -460
- package/lib/errors/DiscordHTTPError.js +63 -63
- package/lib/errors/DiscordRESTError.js +77 -77
- package/lib/gateway/Shard.js +3029 -3029
- package/lib/gateway/ShardManager.js +164 -164
- package/lib/rest/Endpoints.js +172 -172
- package/lib/rest/RequestHandler.js +459 -459
- package/lib/structures/ApplicationCommand.js +125 -125
- package/lib/structures/AutoModerationRule.js +143 -143
- package/lib/structures/AutocompleteInteraction.js +80 -80
- package/lib/structures/Base.js +81 -81
- package/lib/structures/CategoryChannel.js +77 -77
- package/lib/structures/Channel.js +98 -98
- package/lib/structures/CommandInteraction.js +473 -473
- package/lib/structures/ComponentInteraction.js +538 -538
- package/lib/structures/DMChannel.js +278 -278
- package/lib/structures/Entitlement.js +77 -77
- package/lib/structures/ExtendedUser.js +46 -46
- package/lib/structures/ForumChannel.js +24 -24
- package/lib/structures/GroupChannel.js +106 -106
- package/lib/structures/Guild.js +1677 -1677
- package/lib/structures/GuildAuditLogEntry.js +190 -190
- package/lib/structures/GuildChannel.js +128 -128
- package/lib/structures/GuildIntegration.js +99 -99
- package/lib/structures/GuildPreview.js +97 -97
- package/lib/structures/GuildScheduledEvent.js +176 -176
- package/lib/structures/GuildTemplate.js +76 -76
- package/lib/structures/GuildTextableChannel.js +260 -260
- package/lib/structures/Interaction.js +133 -133
- package/lib/structures/Invite.js +143 -143
- package/lib/structures/Lobby.js +108 -108
- package/lib/structures/LobbyMember.js +59 -59
- package/lib/structures/MediaChannel.js +216 -216
- package/lib/structures/Member.js +371 -371
- package/lib/structures/Message.js +708 -708
- package/lib/structures/ModalSubmitInteraction.js +478 -478
- package/lib/structures/NewsChannel.js +34 -34
- package/lib/structures/NewsThreadChannel.js +12 -12
- package/lib/structures/Permission.js +80 -80
- package/lib/structures/PermissionOverwrite.js +32 -32
- package/lib/structures/PingInteraction.js +39 -39
- package/lib/structures/PrivateThreadChannel.js +25 -25
- package/lib/structures/PublicThreadChannel.js +26 -26
- package/lib/structures/Role.js +163 -163
- package/lib/structures/SKU.js +80 -80
- package/lib/structures/SoundboardSound.js +79 -79
- package/lib/structures/StageChannel.js +59 -59
- package/lib/structures/StageInstance.js +55 -55
- package/lib/structures/Subscription.js +69 -69
- package/lib/structures/TextChannel.js +202 -202
- package/lib/structures/ThreadChannel.js +143 -143
- package/lib/structures/ThreadMember.js +59 -59
- package/lib/structures/UnavailableGuild.js +26 -26
- package/lib/structures/UnknownInteraction.js +502 -502
- package/lib/structures/User.js +296 -296
- package/lib/structures/VoiceChannel.js +166 -166
- package/lib/structures/VoiceState.js +84 -84
- package/lib/util/BrowserWebSocket.js +76 -76
- package/lib/util/Bucket.js +89 -89
- package/lib/util/Collection.js +202 -202
- package/lib/util/MultipartData.js +70 -70
- package/lib/util/Opus.js +33 -33
- package/lib/util/SequentialBucket.js +83 -83
- package/lib/util/emitDeprecation.js +26 -26
- package/lib/voice/Piper.js +300 -300
- package/lib/voice/SharedStream.js +238 -238
- package/lib/voice/VoiceConnection.js +1440 -1440
- package/lib/voice/VoiceConnectionManager.js +151 -151
- package/lib/voice/VoiceDataStream.js +22 -22
- package/lib/voice/streams/BaseTransformer.js +40 -40
- package/lib/voice/streams/DCAOpusTransformer.js +78 -78
- package/lib/voice/streams/FFmpegDuplex.js +192 -192
- package/lib/voice/streams/FFmpegOggTransformer.js +35 -35
- package/lib/voice/streams/FFmpegPCMTransformer.js +26 -26
- package/lib/voice/streams/OggOpusTransformer.js +108 -108
- package/lib/voice/streams/PCMOpusTransformer.js +61 -61
- package/lib/voice/streams/VolumeTransformer.js +50 -50
- package/lib/voice/streams/WebmOpusTransformer.js +258 -258
- package/package.json +83 -82
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
class DiscordHTTPError extends Error {
|
|
4
|
-
constructor(req, res, response, stack) {
|
|
5
|
-
super();
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(this, "req", {
|
|
8
|
-
enumerable: false,
|
|
9
|
-
value: req,
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(this, "res", {
|
|
12
|
-
enumerable: false,
|
|
13
|
-
value: res,
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "response", {
|
|
16
|
-
enumerable: false,
|
|
17
|
-
value: response,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.defineProperty(this, "code", {
|
|
21
|
-
enumerable: false,
|
|
22
|
-
value: res.statusCode,
|
|
23
|
-
});
|
|
24
|
-
let message = `${res.statusCode} ${res.statusMessage} on ${req.method} ${req.path}`;
|
|
25
|
-
const errors = this.flattenErrors(response);
|
|
26
|
-
if (errors.length > 0) {
|
|
27
|
-
message += "\n " + errors.join("\n ");
|
|
28
|
-
}
|
|
29
|
-
Object.defineProperty(this, "message", {
|
|
30
|
-
enumerable: false,
|
|
31
|
-
value: message,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (stack) {
|
|
35
|
-
this.stack = this.name + ": " + this.message + "\n" + stack;
|
|
36
|
-
} else {
|
|
37
|
-
Error.captureStackTrace(this, DiscordHTTPError);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get headers() {
|
|
42
|
-
return this.response.headers;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get name() {
|
|
46
|
-
return this.constructor.name;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
flattenErrors(errors, keyPrefix = "") {
|
|
50
|
-
let messages = [];
|
|
51
|
-
for (const fieldName in errors) {
|
|
52
|
-
if (!errors.hasOwnProperty(fieldName) || fieldName === "message" || fieldName === "code") {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (Array.isArray(errors[fieldName])) {
|
|
56
|
-
messages = messages.concat(errors[fieldName].map((str) => `${keyPrefix + fieldName}: ${str}`));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return messages;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
module.exports = DiscordHTTPError;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
class DiscordHTTPError extends Error {
|
|
4
|
+
constructor(req, res, response, stack) {
|
|
5
|
+
super();
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(this, "req", {
|
|
8
|
+
enumerable: false,
|
|
9
|
+
value: req,
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(this, "res", {
|
|
12
|
+
enumerable: false,
|
|
13
|
+
value: res,
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(this, "response", {
|
|
16
|
+
enumerable: false,
|
|
17
|
+
value: response,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
Object.defineProperty(this, "code", {
|
|
21
|
+
enumerable: false,
|
|
22
|
+
value: res.statusCode,
|
|
23
|
+
});
|
|
24
|
+
let message = `${res.statusCode} ${res.statusMessage} on ${req.method} ${req.path}`;
|
|
25
|
+
const errors = this.flattenErrors(response);
|
|
26
|
+
if (errors.length > 0) {
|
|
27
|
+
message += "\n " + errors.join("\n ");
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(this, "message", {
|
|
30
|
+
enumerable: false,
|
|
31
|
+
value: message,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (stack) {
|
|
35
|
+
this.stack = this.name + ": " + this.message + "\n" + stack;
|
|
36
|
+
} else {
|
|
37
|
+
Error.captureStackTrace(this, DiscordHTTPError);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get headers() {
|
|
42
|
+
return this.response.headers;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get name() {
|
|
46
|
+
return this.constructor.name;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
flattenErrors(errors, keyPrefix = "") {
|
|
50
|
+
let messages = [];
|
|
51
|
+
for (const fieldName in errors) {
|
|
52
|
+
if (!errors.hasOwnProperty(fieldName) || fieldName === "message" || fieldName === "code") {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(errors[fieldName])) {
|
|
56
|
+
messages = messages.concat(errors[fieldName].map((str) => `${keyPrefix + fieldName}: ${str}`));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return messages;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = DiscordHTTPError;
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
class DiscordRESTError extends Error {
|
|
4
|
-
constructor(req, res, response, stack) {
|
|
5
|
-
super();
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(this, "req", {
|
|
8
|
-
enumerable: false,
|
|
9
|
-
value: req,
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(this, "res", {
|
|
12
|
-
enumerable: false,
|
|
13
|
-
value: res,
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(this, "response", {
|
|
16
|
-
enumerable: false,
|
|
17
|
-
value: response,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Object.defineProperty(this, "code", {
|
|
21
|
-
enumerable: false,
|
|
22
|
-
value: +response.code || -1,
|
|
23
|
-
});
|
|
24
|
-
let message = response.message || "Unknown error";
|
|
25
|
-
if (response.errors) {
|
|
26
|
-
message += "\n " + this.flattenErrors(response.errors).join("\n ");
|
|
27
|
-
} else {
|
|
28
|
-
const errors = this.flattenErrors(response);
|
|
29
|
-
if (errors.length > 0) {
|
|
30
|
-
message += "\n " + errors.join("\n ");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
Object.defineProperty(this, "message", {
|
|
34
|
-
enumerable: false,
|
|
35
|
-
value: message,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
if (stack) {
|
|
39
|
-
this.stack = this.name + ": " + this.message + "\n" + stack;
|
|
40
|
-
} else {
|
|
41
|
-
Error.captureStackTrace(this, DiscordRESTError);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get headers() {
|
|
46
|
-
return this.response.headers;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get name() {
|
|
50
|
-
return `${this.constructor.name} [${this.code}]`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
flattenErrors(errors, keyPrefix = "") {
|
|
54
|
-
let messages = [];
|
|
55
|
-
for (const fieldName in errors) {
|
|
56
|
-
if (!errors.hasOwnProperty(fieldName) || fieldName === "message" || fieldName === "code") {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (fieldName === "_errors") {
|
|
60
|
-
messages = messages.concat(
|
|
61
|
-
errors._errors.map((obj) => `${keyPrefix ? `${keyPrefix}: ` : ""}${obj.message}`),
|
|
62
|
-
);
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (errors[fieldName]._errors) {
|
|
66
|
-
messages = messages.concat(errors[fieldName]._errors.map((obj) => `${keyPrefix + fieldName}: ${obj.message}`));
|
|
67
|
-
} else if (Array.isArray(errors[fieldName])) {
|
|
68
|
-
messages = messages.concat(errors[fieldName].map((str) => `${keyPrefix + fieldName}: ${str}`));
|
|
69
|
-
} else if (typeof errors[fieldName] === "object") {
|
|
70
|
-
messages = messages.concat(this.flattenErrors(errors[fieldName], keyPrefix + fieldName + "."));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return messages;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
module.exports = DiscordRESTError;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
class DiscordRESTError extends Error {
|
|
4
|
+
constructor(req, res, response, stack) {
|
|
5
|
+
super();
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(this, "req", {
|
|
8
|
+
enumerable: false,
|
|
9
|
+
value: req,
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(this, "res", {
|
|
12
|
+
enumerable: false,
|
|
13
|
+
value: res,
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(this, "response", {
|
|
16
|
+
enumerable: false,
|
|
17
|
+
value: response,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
Object.defineProperty(this, "code", {
|
|
21
|
+
enumerable: false,
|
|
22
|
+
value: +response.code || -1,
|
|
23
|
+
});
|
|
24
|
+
let message = response.message || "Unknown error";
|
|
25
|
+
if (response.errors) {
|
|
26
|
+
message += "\n " + this.flattenErrors(response.errors).join("\n ");
|
|
27
|
+
} else {
|
|
28
|
+
const errors = this.flattenErrors(response);
|
|
29
|
+
if (errors.length > 0) {
|
|
30
|
+
message += "\n " + errors.join("\n ");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
Object.defineProperty(this, "message", {
|
|
34
|
+
enumerable: false,
|
|
35
|
+
value: message,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (stack) {
|
|
39
|
+
this.stack = this.name + ": " + this.message + "\n" + stack;
|
|
40
|
+
} else {
|
|
41
|
+
Error.captureStackTrace(this, DiscordRESTError);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get headers() {
|
|
46
|
+
return this.response.headers;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get name() {
|
|
50
|
+
return `${this.constructor.name} [${this.code}]`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
flattenErrors(errors, keyPrefix = "") {
|
|
54
|
+
let messages = [];
|
|
55
|
+
for (const fieldName in errors) {
|
|
56
|
+
if (!errors.hasOwnProperty(fieldName) || fieldName === "message" || fieldName === "code") {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (fieldName === "_errors") {
|
|
60
|
+
messages = messages.concat(
|
|
61
|
+
errors._errors.map((obj) => `${keyPrefix ? `${keyPrefix}: ` : ""}${obj.message}`),
|
|
62
|
+
);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (errors[fieldName]._errors) {
|
|
66
|
+
messages = messages.concat(errors[fieldName]._errors.map((obj) => `${keyPrefix + fieldName}: ${obj.message}`));
|
|
67
|
+
} else if (Array.isArray(errors[fieldName])) {
|
|
68
|
+
messages = messages.concat(errors[fieldName].map((str) => `${keyPrefix + fieldName}: ${str}`));
|
|
69
|
+
} else if (typeof errors[fieldName] === "object") {
|
|
70
|
+
messages = messages.concat(this.flattenErrors(errors[fieldName], keyPrefix + fieldName + "."));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return messages;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = DiscordRESTError;
|