disgroove 3.0.0-dev.fd521a8 → 3.0.1-dev.24a02ed
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 +9 -9
- package/README.md +48 -48
- package/dist/lib/Client.d.ts +68 -58
- package/dist/lib/Client.js +59 -23
- package/dist/lib/constants.d.ts +17 -4
- package/dist/lib/constants.js +18 -4
- package/dist/lib/gateway/Dispatcher.d.ts +104 -0
- package/dist/lib/gateway/Dispatcher.js +472 -0
- package/dist/lib/gateway/Shard.d.ts +10 -22
- package/dist/lib/gateway/Shard.js +123 -656
- package/dist/lib/gateway/Transmitter.d.ts +22 -0
- package/dist/lib/gateway/Transmitter.js +93 -0
- package/dist/lib/rest/Endpoints.d.ts +3 -0
- package/dist/lib/rest/Endpoints.js +10 -3
- package/dist/lib/rest/RequestManager.js +21 -7
- package/dist/lib/rest/index.js +17 -7
- package/dist/lib/transformers/Components.d.ts +3 -1
- package/dist/lib/transformers/Components.js +26 -0
- package/dist/lib/transformers/Guilds.d.ts +2 -0
- package/dist/lib/transformers/Guilds.js +134 -0
- package/dist/lib/transformers/Interactions.js +30 -0
- package/dist/lib/transformers/Invites.js +2 -2
- package/dist/lib/transformers/Presences.d.ts +3 -3
- package/dist/lib/types/components.d.ts +36 -4
- package/dist/lib/types/gateway-events.d.ts +203 -75
- package/dist/lib/types/interaction.d.ts +3 -3
- package/dist/lib/types/invite.d.ts +5 -2
- package/dist/lib/utils/errors.d.ts +3 -1
- package/dist/lib/utils/errors.js +4 -0
- package/dist/lib/utils/formatters.js +9 -10
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +18 -7
- package/dist/lib/utils/permissions.d.ts +2 -0
- package/dist/lib/utils/permissions.js +7 -0
- package/dist/package.json +5 -5
- package/package.json +6 -6
- package/dist/lib/types/message-components.d.ts +0 -450
- package/dist/lib/types/message-components.js +0 -2
|
@@ -6,7 +6,7 @@ import type { snowflake } from "./common";
|
|
|
6
6
|
import type { RawEntitlement, Entitlement } from "./entitlements";
|
|
7
7
|
import type { RawGuildMember, GuildMember, Guild, RawGuild } from "./guild";
|
|
8
8
|
import type { RawMessage, RawAttachment, RawEmbed, RawAllowedMentions, Message, Attachment, Embed, AllowedMentions } from "./message";
|
|
9
|
-
import type { ActionRow, ChannelSelectInteractionResponse, Container, File, Label, LabelInteractionResponse, MediaGallery, MentionableSelectInteractionResponse, RawActionRow, RawChannelSelectInteractionResponse, RawContainer, RawFile, RawLabel, RawLabelInteractionResponse, RawMediaGallery, RawMentionableSelectInteractionResponse, RawRoleSelectInteractionResponse, RawSection, RawSeparator, RawStringSelectInteractionResponse, RawTextDisplay, RawTextDisplayInteractionResponse, RawTextInputInteractionResponse, RawUserSelectInteractionResponse, RoleSelectInteractionResponse, Section, Separator, StringSelectInteractionResponse, TextDisplay, TextDisplayInteractionResponse, TextInputInteractionResponse, UserSelectInteractionResponse } from "./components";
|
|
9
|
+
import type { ActionRow, ChannelSelectInteractionResponse, Container, File, FileUploadInteractionResponse, Label, LabelInteractionResponse, MediaGallery, MentionableSelectInteractionResponse, RawActionRow, RawChannelSelectInteractionResponse, RawContainer, RawFile, RawFileUploadInteractionResponse, RawLabel, RawLabelInteractionResponse, RawMediaGallery, RawMentionableSelectInteractionResponse, RawRoleSelectInteractionResponse, RawSection, RawSeparator, RawStringSelectInteractionResponse, RawTextDisplay, RawTextDisplayInteractionResponse, RawTextInputInteractionResponse, RawUserSelectInteractionResponse, RoleSelectInteractionResponse, Section, Separator, StringSelectInteractionResponse, TextDisplay, TextDisplayInteractionResponse, TextInputInteractionResponse, UserSelectInteractionResponse } from "./components";
|
|
10
10
|
import type { RawPollCreateParams, PollCreateParams } from "./poll";
|
|
11
11
|
import type { RawRole, Role } from "./role";
|
|
12
12
|
import type { RawUser, User } from "./user";
|
|
@@ -57,7 +57,7 @@ export interface RawModalSubmitData {
|
|
|
57
57
|
custom_id: string;
|
|
58
58
|
components: Array<{
|
|
59
59
|
type: ComponentTypes.ActionRow;
|
|
60
|
-
components: Array<RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse>;
|
|
60
|
+
components: Array<RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse | RawFileUploadInteractionResponse>;
|
|
61
61
|
} | RawTextDisplayInteractionResponse | RawLabelInteractionResponse>;
|
|
62
62
|
resolved?: RawResolvedData;
|
|
63
63
|
}
|
|
@@ -177,7 +177,7 @@ export interface ModalSubmitData {
|
|
|
177
177
|
customId: string;
|
|
178
178
|
components: Array<{
|
|
179
179
|
type: ComponentTypes.ActionRow;
|
|
180
|
-
components: Array<TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse>;
|
|
180
|
+
components: Array<TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse | FileUploadInteractionResponse>;
|
|
181
181
|
} | TextDisplayInteractionResponse | LabelInteractionResponse>;
|
|
182
182
|
resolved?: ResolvedData;
|
|
183
183
|
}
|
|
@@ -4,12 +4,13 @@ import type { RawChannel, Channel } from "./channel";
|
|
|
4
4
|
import type { timestamp } from "./common";
|
|
5
5
|
import type { RawGuild, RawGuildMember, Guild, GuildMember } from "./guild";
|
|
6
6
|
import type { RawGuildScheduledEvent, GuildScheduledEvent } from "./guild-scheduled-event";
|
|
7
|
+
import type { RawRole, Role } from "./role";
|
|
7
8
|
import type { RawUser, User } from "./user";
|
|
8
9
|
/** https://discord.com/developers/docs/resources/invite#invite-object-invite-structure */
|
|
9
10
|
export interface RawInvite {
|
|
10
11
|
type: InviteTypes;
|
|
11
12
|
code: string;
|
|
12
|
-
guild?: RawGuild
|
|
13
|
+
guild?: Partial<RawGuild>;
|
|
13
14
|
channel: RawChannel;
|
|
14
15
|
inviter?: RawUser;
|
|
15
16
|
target_type?: InviteTargetTypes;
|
|
@@ -21,6 +22,7 @@ export interface RawInvite {
|
|
|
21
22
|
stage_instance?: RawInviteStageInstance;
|
|
22
23
|
guild_scheduled_event?: RawGuildScheduledEvent;
|
|
23
24
|
flags?: GuildInviteFlags;
|
|
25
|
+
roles?: Array<RawRole>;
|
|
24
26
|
}
|
|
25
27
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
26
28
|
export interface RawInviteMetadata {
|
|
@@ -41,7 +43,7 @@ export interface RawInviteStageInstance {
|
|
|
41
43
|
export interface Invite {
|
|
42
44
|
type: InviteTypes;
|
|
43
45
|
code: string;
|
|
44
|
-
guild?: Guild
|
|
46
|
+
guild?: Partial<Guild>;
|
|
45
47
|
channel: Channel;
|
|
46
48
|
inviter?: User;
|
|
47
49
|
targetType?: InviteTargetTypes;
|
|
@@ -53,6 +55,7 @@ export interface Invite {
|
|
|
53
55
|
stageInstance?: InviteStageInstance;
|
|
54
56
|
guildScheduledEvent?: GuildScheduledEvent;
|
|
55
57
|
flags?: GuildInviteFlags;
|
|
58
|
+
roles?: Array<Role>;
|
|
56
59
|
}
|
|
57
60
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
58
61
|
export interface InviteMetadata {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { GatewayOPCodes, type JSONErrorCodes } from "../constants";
|
|
2
2
|
export declare class RESTError extends Error {
|
|
3
3
|
name: string;
|
|
4
4
|
method: string;
|
|
@@ -14,5 +14,7 @@ export declare class HTTPError extends Error {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class GatewayError extends Error {
|
|
16
16
|
name: string;
|
|
17
|
+
code: GatewayOPCodes | number;
|
|
18
|
+
reason: string;
|
|
17
19
|
constructor(code: number, reason: string);
|
|
18
20
|
}
|
package/dist/lib/utils/errors.js
CHANGED
|
@@ -47,8 +47,12 @@ class HTTPError extends Error {
|
|
|
47
47
|
exports.HTTPError = HTTPError;
|
|
48
48
|
class GatewayError extends Error {
|
|
49
49
|
name = "GatewayError";
|
|
50
|
+
code;
|
|
51
|
+
reason;
|
|
50
52
|
constructor(code, reason) {
|
|
51
53
|
super(`[${code}] ${reason}`);
|
|
54
|
+
this.code = code;
|
|
55
|
+
this.reason = reason;
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
exports.GatewayError = GatewayError;
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.userMention = userMention;
|
|
4
|
+
exports.channelMention = channelMention;
|
|
5
|
+
exports.roleMention = roleMention;
|
|
6
|
+
exports.slashCommandMention = slashCommandMention;
|
|
7
|
+
exports.customEmoji = customEmoji;
|
|
8
|
+
exports.unixTimestamp = unixTimestamp;
|
|
9
|
+
exports.guildNavigation = guildNavigation;
|
|
10
|
+
exports.email = email;
|
|
11
|
+
exports.phoneNumber = phoneNumber;
|
|
4
12
|
const constants_1 = require("../constants");
|
|
5
13
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
6
14
|
function userMention(userId) {
|
|
7
15
|
return `<@${userId}>`;
|
|
8
16
|
}
|
|
9
|
-
exports.userMention = userMention;
|
|
10
17
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
11
18
|
function channelMention(channelId) {
|
|
12
19
|
return `<#${channelId}>`;
|
|
13
20
|
}
|
|
14
|
-
exports.channelMention = channelMention;
|
|
15
21
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
16
22
|
function roleMention(roleId) {
|
|
17
23
|
return `<@&${roleId}>`;
|
|
18
24
|
}
|
|
19
|
-
exports.roleMention = roleMention;
|
|
20
25
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
21
26
|
function slashCommandMention(commandName, commandId, subCommandName, subCommandGroupName) {
|
|
22
27
|
return subCommandName
|
|
@@ -25,33 +30,27 @@ function slashCommandMention(commandName, commandId, subCommandName, subCommandG
|
|
|
25
30
|
: `</${commandName} ${subCommandName}:${commandId}>`
|
|
26
31
|
: `</${commandName}:${commandId}>`;
|
|
27
32
|
}
|
|
28
|
-
exports.slashCommandMention = slashCommandMention;
|
|
29
33
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
30
34
|
function customEmoji(emojiName, emojiId, animated) {
|
|
31
35
|
return animated
|
|
32
36
|
? `<a:${emojiName}:${emojiId}>`
|
|
33
37
|
: `<:${emojiName}:${emojiId}>`;
|
|
34
38
|
}
|
|
35
|
-
exports.customEmoji = customEmoji;
|
|
36
39
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
37
40
|
function unixTimestamp(time, style) {
|
|
38
41
|
return style ? `<t:${time}:${style}>` : `<t:${time}>`;
|
|
39
42
|
}
|
|
40
|
-
exports.unixTimestamp = unixTimestamp;
|
|
41
43
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
42
44
|
function guildNavigation(guildId, type, roleId) {
|
|
43
45
|
return roleId && type === constants_1.GuildNavigationTypes.LinkedRoles
|
|
44
46
|
? `<${guildId}:${type}:${roleId}>`
|
|
45
47
|
: `<${guildId}:${type}>`;
|
|
46
48
|
}
|
|
47
|
-
exports.guildNavigation = guildNavigation;
|
|
48
49
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
49
50
|
function email(username, domain) {
|
|
50
51
|
return `<${username}@${domain}>`;
|
|
51
52
|
}
|
|
52
|
-
exports.email = email;
|
|
53
53
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
54
54
|
function phoneNumber(number) {
|
|
55
55
|
return `<+${number}>`;
|
|
56
56
|
}
|
|
57
|
-
exports.phoneNumber = phoneNumber;
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
37
|
};
|
|
@@ -30,3 +40,4 @@ exports.CDN = void 0;
|
|
|
30
40
|
exports.CDN = __importStar(require("./CDN"));
|
|
31
41
|
__exportStar(require("./errors"), exports);
|
|
32
42
|
__exportStar(require("./formatters"), exports);
|
|
43
|
+
__exportStar(require("./permissions"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasPermission = hasPermission;
|
|
4
|
+
/** https://discord.com/developers/docs/topics/permissions */
|
|
5
|
+
function hasPermission(userPermissions, permission) {
|
|
6
|
+
return (BigInt(userPermissions) & permission) === permission;
|
|
7
|
+
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disgroove",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1-dev.24a02ed",
|
|
4
4
|
"description": "A module to interface with Discord",
|
|
5
5
|
"main": "./dist/lib/index.js",
|
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/sergiogotuzzo/disgroove#readme",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^22.
|
|
28
|
+
"@types/node": "^22.19.3",
|
|
29
29
|
"@types/ws": "^8.18.1",
|
|
30
|
-
"typescript": "^5.9.
|
|
31
|
-
"undici-types": "^7.
|
|
30
|
+
"typescript": "^5.9.3",
|
|
31
|
+
"undici-types": "^7.18.2"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"ws": "^8.
|
|
34
|
+
"ws": "^8.19.0"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disgroove",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1-dev.24a02ed",
|
|
4
4
|
"description": "A module to interface with Discord",
|
|
5
5
|
"main": "./dist/lib/index.js",
|
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/sergiogotuzzo/disgroove#readme",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^22.
|
|
28
|
+
"@types/node": "^22.19.3",
|
|
29
29
|
"@types/ws": "^8.18.1",
|
|
30
|
-
"typescript": "^5.9.
|
|
31
|
-
"undici-types": "^7.
|
|
30
|
+
"typescript": "^5.9.3",
|
|
31
|
+
"undici-types": "^7.18.2"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"ws": "^8.
|
|
34
|
+
"ws": "^8.19.0"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|