disgroove 3.0.0-dev.51640ff → 3.0.0-dev.681c806
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 +0 -3
- package/dist/lib/constants.d.ts +2 -1
- package/dist/lib/constants.js +1 -0
- package/dist/lib/gateway/Shard.d.ts +3 -2
- package/dist/lib/gateway/Shard.js +128 -95
- package/dist/lib/rest/RequestManager.js +17 -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/Interactions.js +30 -0
- package/dist/lib/types/components.d.ts +36 -4
- package/dist/lib/types/interaction.d.ts +3 -3
- 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 +1 -1
- package/package.json +2 -2
- package/dist/lib/types/message-components.d.ts +0 -450
- package/dist/lib/types/message-components.js +0 -2
|
@@ -222,13 +222,29 @@ export interface RawLabel {
|
|
|
222
222
|
id?: number;
|
|
223
223
|
label: string;
|
|
224
224
|
description?: string;
|
|
225
|
-
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect;
|
|
225
|
+
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect | RawFileUpload;
|
|
226
226
|
}
|
|
227
227
|
/** https://discord.com/developers/docs/components/reference#label-label-interaction-response-structure */
|
|
228
228
|
export interface RawLabelInteractionResponse {
|
|
229
229
|
type: ComponentTypes.Label;
|
|
230
230
|
id: number;
|
|
231
|
-
component: RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse;
|
|
231
|
+
component: RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse | RawFileUploadInteractionResponse;
|
|
232
|
+
}
|
|
233
|
+
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-structure */
|
|
234
|
+
export interface RawFileUpload {
|
|
235
|
+
type: ComponentTypes.FileUpload;
|
|
236
|
+
id?: number;
|
|
237
|
+
custom_id: string;
|
|
238
|
+
min_values?: number;
|
|
239
|
+
max_values?: number;
|
|
240
|
+
required?: boolean;
|
|
241
|
+
}
|
|
242
|
+
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-interaction-response-structure */
|
|
243
|
+
export interface RawFileUploadInteractionResponse {
|
|
244
|
+
type: ComponentTypes.FileUpload;
|
|
245
|
+
id: number;
|
|
246
|
+
custom_id: string;
|
|
247
|
+
values: Array<snowflake>;
|
|
232
248
|
}
|
|
233
249
|
/** https://discord.com/developers/docs/components/reference#unfurled-media-item-unfurled-media-item-structure */
|
|
234
250
|
export interface RawUnfurledMediaItem {
|
|
@@ -459,13 +475,29 @@ export interface Label {
|
|
|
459
475
|
id?: number;
|
|
460
476
|
label: string;
|
|
461
477
|
description?: string;
|
|
462
|
-
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect;
|
|
478
|
+
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect | FileUpload;
|
|
463
479
|
}
|
|
464
480
|
/** https://discord.com/developers/docs/components/reference#label-label-interaction-response-structure */
|
|
465
481
|
export interface LabelInteractionResponse {
|
|
466
482
|
type: ComponentTypes.Label;
|
|
467
483
|
id: number;
|
|
468
|
-
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse;
|
|
484
|
+
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse | FileUploadInteractionResponse;
|
|
485
|
+
}
|
|
486
|
+
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-structure */
|
|
487
|
+
export interface FileUpload {
|
|
488
|
+
type: ComponentTypes.FileUpload;
|
|
489
|
+
id?: number;
|
|
490
|
+
customId: string;
|
|
491
|
+
minValues?: number;
|
|
492
|
+
maxValues?: number;
|
|
493
|
+
required?: boolean;
|
|
494
|
+
}
|
|
495
|
+
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-interaction-response-structure */
|
|
496
|
+
export interface FileUploadInteractionResponse {
|
|
497
|
+
type: ComponentTypes.FileUpload;
|
|
498
|
+
id: number;
|
|
499
|
+
customId: string;
|
|
500
|
+
values: Array<snowflake>;
|
|
469
501
|
}
|
|
470
502
|
/** https://discord.com/developers/docs/components/reference#unfurled-media-item-unfurled-media-item-structure */
|
|
471
503
|
export interface UnfurledMediaItem {
|
|
@@ -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
|
}
|
|
@@ -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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disgroove",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.681c806",
|
|
4
4
|
"description": "A module to interface with Discord",
|
|
5
5
|
"main": "./dist/lib/index.js",
|
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"ws": "^8.18.3"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|