disgroove 2.2.2 → 2.2.3-dev.10e8e97
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 +72 -80
- package/dist/lib/Client.js +209 -100
- package/dist/lib/gateway/Shard.d.ts +1 -0
- package/dist/lib/gateway/Shard.js +11 -5
- package/dist/lib/gateway/index.d.ts +0 -1
- package/dist/lib/gateway/index.js +0 -1
- 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/gateway-events.d.ts +4 -4
- 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/gateway/ShardManager.d.ts +0 -10
- package/dist/lib/gateway/ShardManager.js +0 -18
- package/dist/lib/utils/Util.d.ts +0 -4
- package/dist/lib/utils/Util.js +0 -63
@@ -4,7 +4,7 @@ import type { snowflake, timestamp } from "./common";
|
|
4
4
|
import type { RawEmoji, Emoji } from "./emoji";
|
5
5
|
import type { RawRole, Role } from "./role";
|
6
6
|
import type { RawSticker, Sticker } from "./sticker";
|
7
|
-
import type { RawUser, User } from "./user";
|
7
|
+
import type { AvatarDecorationData, RawAvatarDecorationData, RawUser, User } from "./user";
|
8
8
|
/** https://discord.com/developers/docs/resources/guild#guild-object-guild-structure */
|
9
9
|
export interface RawGuild {
|
10
10
|
id: snowflake;
|
@@ -98,6 +98,7 @@ export interface RawGuildMember {
|
|
98
98
|
pending?: boolean;
|
99
99
|
permissions?: string;
|
100
100
|
communication_disabled_until?: number | null;
|
101
|
+
avatar_decoration_data?: RawAvatarDecorationData | null;
|
101
102
|
}
|
102
103
|
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */
|
103
104
|
export interface RawIntegration {
|
@@ -265,6 +266,7 @@ export interface GuildMember {
|
|
265
266
|
pending?: boolean;
|
266
267
|
permissions?: string;
|
267
268
|
communicationDisabledUntil?: number | null;
|
269
|
+
avatarDecorationData?: AvatarDecorationData | null;
|
268
270
|
}
|
269
271
|
export interface Integration {
|
270
272
|
id: snowflake;
|
package/dist/lib/types/user.d.ts
CHANGED
@@ -20,7 +20,7 @@ export interface RawUser {
|
|
20
20
|
flags?: UserFlags;
|
21
21
|
premium_type?: PremiumTypes;
|
22
22
|
public_flags?: UserFlags;
|
23
|
-
|
23
|
+
avatar_decoration_data?: RawAvatarDecorationData | null;
|
24
24
|
}
|
25
25
|
/** https://discord.com/developers/docs/resources/user#avatar-decoration-data-object-avatar-decoration-data-structure */
|
26
26
|
export interface RawAvatarDecorationData {
|
@@ -63,7 +63,7 @@ export interface User {
|
|
63
63
|
flags?: UserFlags;
|
64
64
|
premiumType?: PremiumTypes;
|
65
65
|
publicFlags?: UserFlags;
|
66
|
-
|
66
|
+
avatarDecorationData?: AvatarDecorationData | null;
|
67
67
|
}
|
68
68
|
export interface AvatarDecorationData {
|
69
69
|
asset: string;
|
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
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { Shard } from ".";
|
2
|
-
import type { GatewayPresenceUpdate } from "../types/gateway-events";
|
3
|
-
export declare class ShardManager extends Map<number, Shard> {
|
4
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
5
|
-
connect(): void;
|
6
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
7
|
-
disconnect(): void;
|
8
|
-
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
9
|
-
updatePresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
|
10
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ShardManager = void 0;
|
4
|
-
class ShardManager extends Map {
|
5
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
6
|
-
connect() {
|
7
|
-
this.forEach((shard) => shard.connect());
|
8
|
-
}
|
9
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
10
|
-
disconnect() {
|
11
|
-
this.forEach((shard) => shard.disconnect());
|
12
|
-
}
|
13
|
-
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
14
|
-
updatePresence(options) {
|
15
|
-
this.forEach((shard) => shard.updatePresence(options));
|
16
|
-
}
|
17
|
-
}
|
18
|
-
exports.ShardManager = ShardManager;
|
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;
|