disgroove 2.2.2 → 2.2.3-dev.4f98e3d
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/README.md +2 -2
- package/dist/lib/Client.d.ts +69 -77
- package/dist/lib/Client.js +204 -95
- package/dist/lib/gateway/Shard.d.ts +1 -0
- package/dist/lib/gateway/Shard.js +10 -4
- package/dist/lib/transformers/ApplicationCommands.d.ts +7 -0
- package/dist/lib/transformers/ApplicationCommands.js +90 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.d.ts +5 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.js +26 -0
- package/dist/lib/transformers/Applications.d.ts +0 -3
- package/dist/lib/transformers/Applications.js +0 -114
- package/dist/lib/transformers/AuditLogs.js +3 -3
- package/dist/lib/transformers/AutoModeration.d.ts +5 -1
- package/dist/lib/transformers/AutoModeration.js +44 -32
- package/dist/lib/transformers/Guilds.js +16 -0
- package/dist/lib/transformers/Presences.d.ts +0 -3
- package/dist/lib/transformers/Presences.js +52 -44
- package/dist/lib/transformers/Users.js +16 -2
- package/dist/lib/transformers/index.d.ts +2 -0
- package/dist/lib/transformers/index.js +2 -0
- package/dist/lib/types/guild.d.ts +3 -1
- package/dist/lib/types/user.d.ts +2 -2
- package/dist/lib/utils/errors.js +4 -4
- package/dist/lib/utils/formatters.d.ts +7 -0
- package/dist/lib/utils/formatters.js +7 -1
- package/dist/lib/utils/index.d.ts +0 -1
- package/dist/lib/utils/index.js +0 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/lib/utils/Util.d.ts +0 -4
- package/dist/lib/utils/Util.js +0 -63
package/dist/lib/utils/errors.js
CHANGED
@@ -11,7 +11,7 @@ class RESTError extends Error {
|
|
11
11
|
this.endpoint = endpoint;
|
12
12
|
}
|
13
13
|
static flattenErrors(errors, prefix = "") {
|
14
|
-
let
|
14
|
+
let message = "";
|
15
15
|
if (errors) {
|
16
16
|
for (const [key, value] of Object.entries(errors)) {
|
17
17
|
if (errors.hasOwnProperty(key)) {
|
@@ -20,17 +20,17 @@ class RESTError extends Error {
|
|
20
20
|
if (typeof error === "object" &&
|
21
21
|
error !== null &&
|
22
22
|
"message" in error) {
|
23
|
-
|
23
|
+
message += `${prefix ? `${prefix}: [${error.code}]` : `[${error.code}]`} ${error.message}\n`;
|
24
24
|
}
|
25
25
|
}
|
26
26
|
}
|
27
27
|
else if (typeof value === "object" && value !== null) {
|
28
|
-
|
28
|
+
message += this.flattenErrors(value, prefix ? `${prefix}.${key}` : key);
|
29
29
|
}
|
30
30
|
}
|
31
31
|
}
|
32
32
|
}
|
33
|
-
return
|
33
|
+
return message;
|
34
34
|
}
|
35
35
|
}
|
36
36
|
exports.RESTError = RESTError;
|
@@ -1,9 +1,16 @@
|
|
1
1
|
import type { GuildNavigationTypes, TimestampStyles } from "../constants";
|
2
2
|
import type { snowflake } from "../types/common";
|
3
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
3
4
|
export declare function userMention(userID: snowflake): string;
|
5
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
4
6
|
export declare function channelMention(channelID: snowflake): string;
|
7
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
5
8
|
export declare function roleMention(roleID: snowflake): string;
|
9
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
6
10
|
export declare function slashCommandMention(commandName: string, commandID: snowflake, subCommandName?: string, subCommandGroupName?: string): string;
|
11
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
7
12
|
export declare function customEmoji(emojiName: string, emojiID: snowflake, animated?: boolean): string;
|
13
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
8
14
|
export declare function unixTimestamp(time: number, style?: TimestampStyles): string;
|
15
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
9
16
|
export declare function guildNavigation(guildID: snowflake, type: GuildNavigationTypes): string;
|
@@ -1,19 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
-
/* https://discord.com/developers/docs/reference#message-formatting */
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
3
|
exports.guildNavigation = exports.unixTimestamp = exports.customEmoji = exports.slashCommandMention = exports.roleMention = exports.channelMention = exports.userMention = void 0;
|
4
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
5
5
|
function userMention(userID) {
|
6
6
|
return `<@${userID}>`;
|
7
7
|
}
|
8
8
|
exports.userMention = userMention;
|
9
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
9
10
|
function channelMention(channelID) {
|
10
11
|
return `<#${channelID}>`;
|
11
12
|
}
|
12
13
|
exports.channelMention = channelMention;
|
14
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
13
15
|
function roleMention(roleID) {
|
14
16
|
return `<@&${roleID}>`;
|
15
17
|
}
|
16
18
|
exports.roleMention = roleMention;
|
19
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
17
20
|
function slashCommandMention(commandName, commandID, subCommandName, subCommandGroupName) {
|
18
21
|
return subCommandName
|
19
22
|
? subCommandGroupName
|
@@ -22,16 +25,19 @@ function slashCommandMention(commandName, commandID, subCommandName, subCommandG
|
|
22
25
|
: `</${commandName}:${commandID}>`;
|
23
26
|
}
|
24
27
|
exports.slashCommandMention = slashCommandMention;
|
28
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
25
29
|
function customEmoji(emojiName, emojiID, animated) {
|
26
30
|
return animated
|
27
31
|
? `<a:${emojiName}:${emojiID}>`
|
28
32
|
: `<:${emojiName}:${emojiID}>`;
|
29
33
|
}
|
30
34
|
exports.customEmoji = customEmoji;
|
35
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
31
36
|
function unixTimestamp(time, style) {
|
32
37
|
return style ? `<t:${time}:${style}>` : `<t:${time}>`;
|
33
38
|
}
|
34
39
|
exports.unixTimestamp = unixTimestamp;
|
40
|
+
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
35
41
|
function guildNavigation(guildID, type) {
|
36
42
|
return `<${guildID}:${type}>`;
|
37
43
|
}
|
package/dist/lib/utils/index.js
CHANGED
package/dist/package.json
CHANGED
package/package.json
CHANGED
package/dist/lib/utils/Util.d.ts
DELETED
package/dist/lib/utils/Util.js
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Util = void 0;
|
4
|
-
class Util {
|
5
|
-
partialApplicationCommandToRaw(applicationCommand) {
|
6
|
-
return {
|
7
|
-
id: applicationCommand.id,
|
8
|
-
type: applicationCommand.type,
|
9
|
-
application_id: applicationCommand.applicationID,
|
10
|
-
guild_id: applicationCommand.guildID,
|
11
|
-
name: applicationCommand.name,
|
12
|
-
name_localizations: applicationCommand.nameLocalizations,
|
13
|
-
description: applicationCommand.description,
|
14
|
-
description_localizations: applicationCommand.descriptionLocalizations,
|
15
|
-
options: applicationCommand.options?.map((option) => ({
|
16
|
-
type: option.type,
|
17
|
-
name: option.name,
|
18
|
-
name_localizations: option.nameLocalizations,
|
19
|
-
description: option.description,
|
20
|
-
description_localizations: option.descriptionLocalizations,
|
21
|
-
required: option.required,
|
22
|
-
choices: option.choices?.map((choice) => ({
|
23
|
-
name: choice.name,
|
24
|
-
name_localizations: choice.nameLocalizations,
|
25
|
-
value: choice.value,
|
26
|
-
})),
|
27
|
-
options: option.options?.map((o) => ({
|
28
|
-
type: o.type,
|
29
|
-
name: o.name,
|
30
|
-
name_localizations: o.nameLocalizations,
|
31
|
-
description: o.description,
|
32
|
-
description_localizations: o.descriptionLocalizations,
|
33
|
-
required: o.required,
|
34
|
-
choices: o.choices?.map((choice) => ({
|
35
|
-
name: choice.name,
|
36
|
-
name_localizations: choice.nameLocalizations,
|
37
|
-
value: choice.value,
|
38
|
-
})),
|
39
|
-
channel_types: o.channelTypes,
|
40
|
-
min_value: o.minValue,
|
41
|
-
max_value: o.maxValue,
|
42
|
-
min_length: o.minLength,
|
43
|
-
max_length: o.maxLength,
|
44
|
-
autocomplete: o.autocomplete,
|
45
|
-
})),
|
46
|
-
channel_types: option.channelTypes,
|
47
|
-
min_value: option.minValue,
|
48
|
-
max_value: option.maxValue,
|
49
|
-
min_length: option.minLength,
|
50
|
-
max_length: option.maxLength,
|
51
|
-
autocomplete: option.autocomplete,
|
52
|
-
})),
|
53
|
-
default_member_permissions: applicationCommand.defaultMemberPermissions,
|
54
|
-
dm_permission: applicationCommand.dmPermission,
|
55
|
-
default_permission: applicationCommand.defaultPermission,
|
56
|
-
integration_types: applicationCommand.integrationTypes,
|
57
|
-
contexts: applicationCommand.contexts,
|
58
|
-
nsfw: applicationCommand.nsfw,
|
59
|
-
version: applicationCommand.version,
|
60
|
-
};
|
61
|
-
}
|
62
|
-
}
|
63
|
-
exports.Util = Util;
|