djs-selfbot-v13 3.1.7 → 3.1.8
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 +1 -1
- package/README.md +18 -45
- package/package.json +8 -37
- package/src/client/BaseClient.js +2 -3
- package/src/client/Client.js +187 -539
- package/src/client/actions/Action.js +18 -13
- package/src/client/actions/ActionsManager.js +7 -1
- package/src/client/actions/AutoModerationActionExecution.js +1 -0
- package/src/client/actions/AutoModerationRuleCreate.js +1 -0
- package/src/client/actions/AutoModerationRuleDelete.js +1 -0
- package/src/client/actions/AutoModerationRuleUpdate.js +1 -0
- package/src/client/actions/MessageCreate.js +0 -4
- package/src/client/actions/PresenceUpdate.js +17 -16
- package/src/client/websocket/WebSocketManager.js +11 -31
- package/src/client/websocket/WebSocketShard.js +39 -38
- package/src/client/websocket/handlers/CALL_CREATE.js +3 -3
- package/src/client/websocket/handlers/CALL_DELETE.js +2 -2
- package/src/client/websocket/handlers/CALL_UPDATE.js +2 -2
- package/src/client/websocket/handlers/CHANNEL_RECIPIENT_ADD.js +16 -13
- package/src/client/websocket/handlers/CHANNEL_RECIPIENT_REMOVE.js +11 -11
- package/src/client/websocket/handlers/GUILD_CREATE.js +7 -0
- package/src/client/websocket/handlers/INTERACTION_MODAL_CREATE.js +1 -0
- package/src/client/websocket/handlers/READY.js +47 -137
- package/src/client/websocket/handlers/RELATIONSHIP_ADD.js +7 -5
- package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +6 -4
- package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +32 -9
- package/src/client/websocket/handlers/USER_GUILD_SETTINGS_UPDATE.js +2 -8
- package/src/client/websocket/handlers/USER_NOTE_UPDATE.js +1 -1
- package/src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.js +78 -0
- package/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +1 -5
- package/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js +12 -0
- package/src/client/websocket/handlers/index.js +15 -20
- package/src/errors/Messages.js +24 -69
- package/src/index.js +12 -43
- package/src/managers/ApplicationCommandManager.js +9 -12
- package/src/managers/ApplicationCommandPermissionsManager.js +3 -11
- package/src/managers/ChannelManager.js +3 -4
- package/src/managers/ClientUserSettingManager.js +161 -279
- package/src/managers/GuildBanManager.js +1 -1
- package/src/managers/GuildChannelManager.js +2 -0
- package/src/managers/GuildForumThreadManager.js +22 -28
- package/src/managers/GuildMemberManager.js +40 -216
- package/src/managers/GuildSettingManager.js +22 -15
- package/src/managers/MessageManager.js +42 -44
- package/src/managers/PermissionOverwriteManager.js +1 -1
- package/src/managers/ReactionUserManager.js +5 -5
- package/src/managers/RelationshipManager.js +81 -74
- package/src/managers/ThreadManager.js +12 -45
- package/src/managers/ThreadMemberManager.js +1 -1
- package/src/managers/UserManager.js +6 -10
- package/src/managers/UserNoteManager.js +53 -0
- package/src/rest/APIRequest.js +42 -20
- package/src/rest/DiscordAPIError.js +17 -16
- package/src/rest/RESTManager.js +1 -21
- package/src/rest/RequestHandler.js +35 -21
- package/src/structures/ApplicationCommand.js +19 -456
- package/src/structures/ApplicationRoleConnectionMetadata.js +3 -0
- package/src/structures/AutoModerationRule.js +5 -5
- package/src/structures/AutocompleteInteraction.js +1 -0
- package/src/structures/BaseGuildTextChannel.js +10 -12
- package/src/structures/BaseGuildVoiceChannel.js +16 -18
- package/src/structures/{Call.js → CallState.js} +17 -12
- package/src/structures/CategoryChannel.js +2 -0
- package/src/structures/Channel.js +2 -3
- package/src/structures/ClientPresence.js +12 -8
- package/src/structures/ClientUser.js +117 -336
- package/src/structures/ContextMenuInteraction.js +1 -1
- package/src/structures/DMChannel.js +29 -92
- package/src/structures/ForumChannel.js +0 -10
- package/src/structures/GroupDMChannel.js +387 -0
- package/src/structures/Guild.js +135 -271
- package/src/structures/GuildAuditLogs.js +0 -5
- package/src/structures/GuildChannel.js +16 -2
- package/src/structures/GuildMember.js +27 -145
- package/src/structures/Interaction.js +1 -62
- package/src/structures/Invite.js +35 -52
- package/src/structures/Message.js +228 -202
- package/src/structures/MessageAttachment.js +11 -0
- package/src/structures/MessageButton.js +1 -67
- package/src/structures/MessageEmbed.js +1 -1
- package/src/structures/MessageMentions.js +3 -2
- package/src/structures/MessagePayload.js +4 -46
- package/src/structures/MessageReaction.js +1 -1
- package/src/structures/MessageSelectMenu.js +1 -252
- package/src/structures/Modal.js +75 -180
- package/src/structures/Presence.js +2 -2
- package/src/structures/RichPresence.js +14 -34
- package/src/structures/Role.js +18 -2
- package/src/structures/SelectMenuInteraction.js +2 -151
- package/src/structures/Team.js +0 -49
- package/src/structures/TextInputComponent.js +0 -70
- package/src/structures/ThreadChannel.js +0 -19
- package/src/structures/User.js +117 -345
- package/src/structures/UserContextMenuInteraction.js +2 -2
- package/src/structures/VoiceState.js +74 -39
- package/src/structures/WebEmbed.js +38 -52
- package/src/structures/Webhook.js +17 -11
- package/src/structures/interfaces/Application.js +146 -23
- package/src/structures/interfaces/TextBasedChannel.js +411 -256
- package/src/util/ApplicationFlags.js +1 -1
- package/src/util/AttachmentFlags.js +38 -0
- package/src/util/Constants.js +106 -284
- package/src/util/Formatters.js +16 -2
- package/src/util/InviteFlags.js +29 -0
- package/src/util/LimitedCollection.js +1 -1
- package/src/util/Options.js +48 -68
- package/src/util/Permissions.js +5 -0
- package/src/util/PurchasedFlags.js +2 -0
- package/src/util/RemoteAuth.js +221 -356
- package/src/util/RoleFlags.js +37 -0
- package/src/util/Sweepers.js +1 -1
- package/src/util/Util.js +76 -36
- package/typings/enums.d.ts +18 -73
- package/typings/index.d.ts +873 -1225
- package/typings/rawDataTypes.d.ts +68 -9
- package/src/client/actions/InteractionCreate.js +0 -115
- package/src/client/websocket/handlers/APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE.js +0 -23
- package/src/client/websocket/handlers/GUILD_APPLICATION_COMMANDS_UPDATE.js +0 -11
- package/src/client/websocket/handlers/GUILD_MEMBER_LIST_UPDATE.js +0 -55
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.js +0 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.js +0 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.js +0 -16
- package/src/client/websocket/handlers/INTERACTION_FAILURE.js +0 -18
- package/src/client/websocket/handlers/INTERACTION_SUCCESS.js +0 -30
- package/src/client/websocket/handlers/MESSAGE_ACK.js +0 -16
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +0 -0
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +0 -0
- package/src/managers/DeveloperPortalManager.js +0 -104
- package/src/managers/GuildApplicationCommandManager.js +0 -28
- package/src/managers/GuildFolderManager.js +0 -24
- package/src/managers/SessionManager.js +0 -57
- package/src/rest/CaptchaSolver.js +0 -132
- package/src/structures/ClientApplication.js +0 -204
- package/src/structures/DeveloperPortalApplication.js +0 -520
- package/src/structures/GuildFolder.js +0 -75
- package/src/structures/InteractionResponse.js +0 -114
- package/src/structures/PartialGroupDMChannel.js +0 -433
- package/src/structures/Session.js +0 -81
- package/src/util/Voice.js +0 -1456
- package/src/util/arRPC/index.js +0 -229
- package/src/util/arRPC/process/detectable.json +0 -1
- package/src/util/arRPC/process/index.js +0 -102
- package/src/util/arRPC/process/native/index.js +0 -5
- package/src/util/arRPC/process/native/linux.js +0 -37
- package/src/util/arRPC/process/native/win32.js +0 -25
- package/src/util/arRPC/transports/ipc.js +0 -281
- package/src/util/arRPC/transports/websocket.js +0 -128
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const BitField = require('./BitField');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Data structure that makes it easy to interact with an {@link GuildMember#flags} bitfield.
|
|
7
|
+
* @extends {BitField}
|
|
8
|
+
*/
|
|
9
|
+
class RoleFlags extends BitField {}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @name RoleFlags
|
|
13
|
+
* @kind constructor
|
|
14
|
+
* @memberof RoleFlags
|
|
15
|
+
* @param {BitFieldResolvable} [bits=0] Bit(s) to read from
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Numeric guild member flags. All available properties:
|
|
20
|
+
* * `IN_PROMPT`
|
|
21
|
+
* @type {Object}
|
|
22
|
+
* @see {@link https://discord.com/developers/docs/topics/permissions#role-object-role-flags}
|
|
23
|
+
*/
|
|
24
|
+
RoleFlags.FLAGS = {
|
|
25
|
+
IN_PROMPT: 1 << 0,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Data that can be resolved to give a role flag bitfield. This can be:
|
|
30
|
+
* * A string (see {@link RoleFlags.FLAGS})
|
|
31
|
+
* * A role flag
|
|
32
|
+
* * An instance of RoleFlags
|
|
33
|
+
* * An Array of RoleFlagsResolvable
|
|
34
|
+
* @typedef {string|number|RoleFlags|RoleFlagsResolvable[]} RoleFlagsResolvable
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
module.exports = RoleFlags;
|
package/src/util/Sweepers.js
CHANGED
|
@@ -7,7 +7,7 @@ const { TypeError } = require('../errors/DJSError.js');
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {Function} GlobalSweepFilter
|
|
9
9
|
* @returns {Function|null} Return `null` to skip sweeping, otherwise a function passed to `sweep()`,
|
|
10
|
-
* See {@link [Collection#sweep](https://discord.js.org/docs/packages/collection/stable/Collection:Class
|
|
10
|
+
* See {@link [Collection#sweep](https://discord.js.org/docs/packages/collection/stable/Collection:Class#sweep)}
|
|
11
11
|
* for the definition of this function.
|
|
12
12
|
*/
|
|
13
13
|
|
package/src/util/Util.js
CHANGED
|
@@ -5,12 +5,17 @@ const process = require('node:process');
|
|
|
5
5
|
const { Collection } = require('@discordjs/collection');
|
|
6
6
|
const fetch = require('node-fetch');
|
|
7
7
|
const { Colors } = require('./Constants');
|
|
8
|
-
const { RangeError, TypeError } = require('../errors');
|
|
8
|
+
const { Error: DiscordError, RangeError, TypeError } = require('../errors');
|
|
9
9
|
const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|
10
10
|
const isObject = d => typeof d === 'object' && d !== null;
|
|
11
11
|
|
|
12
12
|
let deprecationEmittedForSplitMessage = false;
|
|
13
13
|
let deprecationEmittedForRemoveMentions = false;
|
|
14
|
+
let deprecationEmittedForResolveAutoArchiveMaxLimit = false;
|
|
15
|
+
|
|
16
|
+
const TextSortableGroupTypes = ['GUILD_TEXT', 'GUILD_ANNOUCMENT', 'GUILD_FORUM'];
|
|
17
|
+
const VoiceSortableGroupTypes = ['GUILD_VOICE', 'GUILD_STAGE_VOICE'];
|
|
18
|
+
const CategorySortableGroupTypes = ['GUILD_CATEGORY'];
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* Contains various general-purpose utility methods.
|
|
@@ -134,6 +139,7 @@ class Util extends null {
|
|
|
134
139
|
* @property {boolean} [numberedList=false] Whether to escape numbered lists
|
|
135
140
|
* @property {boolean} [maskedLink=false] Whether to escape masked links
|
|
136
141
|
*/
|
|
142
|
+
|
|
137
143
|
/**
|
|
138
144
|
* Escapes any Discord-flavour markdown in a string.
|
|
139
145
|
* @param {string} text Content to escape
|
|
@@ -216,6 +222,7 @@ class Util extends null {
|
|
|
216
222
|
if (maskedLink) text = Util.escapeMaskedLink(text);
|
|
217
223
|
return text;
|
|
218
224
|
}
|
|
225
|
+
|
|
219
226
|
/**
|
|
220
227
|
* Escapes code block markdown in a string.
|
|
221
228
|
* @param {string} text Content to escape
|
|
@@ -224,6 +231,7 @@ class Util extends null {
|
|
|
224
231
|
static escapeCodeBlock(text) {
|
|
225
232
|
return text.replaceAll('```', '\\`\\`\\`');
|
|
226
233
|
}
|
|
234
|
+
|
|
227
235
|
/**
|
|
228
236
|
* Escapes inline code markdown in a string.
|
|
229
237
|
* @param {string} text Content to escape
|
|
@@ -232,6 +240,7 @@ class Util extends null {
|
|
|
232
240
|
static escapeInlineCode(text) {
|
|
233
241
|
return text.replace(/(?<=^|[^`])``?(?=[^`]|$)/g, match => (match.length === 2 ? '\\`\\`' : '\\`'));
|
|
234
242
|
}
|
|
243
|
+
|
|
235
244
|
/**
|
|
236
245
|
* Escapes italic markdown in a string.
|
|
237
246
|
* @param {string} text Content to escape
|
|
@@ -249,6 +258,7 @@ class Util extends null {
|
|
|
249
258
|
return `\\_${match}`;
|
|
250
259
|
});
|
|
251
260
|
}
|
|
261
|
+
|
|
252
262
|
/**
|
|
253
263
|
* Escapes bold markdown in a string.
|
|
254
264
|
* @param {string} text Content to escape
|
|
@@ -261,6 +271,7 @@ class Util extends null {
|
|
|
261
271
|
return '\\*\\*';
|
|
262
272
|
});
|
|
263
273
|
}
|
|
274
|
+
|
|
264
275
|
/**
|
|
265
276
|
* Escapes underline markdown in a string.
|
|
266
277
|
* @param {string} text Content to escape
|
|
@@ -273,6 +284,7 @@ class Util extends null {
|
|
|
273
284
|
return '\\_\\_';
|
|
274
285
|
});
|
|
275
286
|
}
|
|
287
|
+
|
|
276
288
|
/**
|
|
277
289
|
* Escapes strikethrough markdown in a string.
|
|
278
290
|
* @param {string} text Content to escape
|
|
@@ -281,6 +293,7 @@ class Util extends null {
|
|
|
281
293
|
static escapeStrikethrough(text) {
|
|
282
294
|
return text.replaceAll('~~', '\\~\\~');
|
|
283
295
|
}
|
|
296
|
+
|
|
284
297
|
/**
|
|
285
298
|
* Escapes spoiler markdown in a string.
|
|
286
299
|
* @param {string} text Content to escape
|
|
@@ -289,6 +302,7 @@ class Util extends null {
|
|
|
289
302
|
static escapeSpoiler(text) {
|
|
290
303
|
return text.replaceAll('||', '\\|\\|');
|
|
291
304
|
}
|
|
305
|
+
|
|
292
306
|
/**
|
|
293
307
|
* Escapes escape characters in a string.
|
|
294
308
|
* @param {string} text Content to escape
|
|
@@ -297,6 +311,7 @@ class Util extends null {
|
|
|
297
311
|
static escapeEscape(text) {
|
|
298
312
|
return text.replaceAll('\\', '\\\\');
|
|
299
313
|
}
|
|
314
|
+
|
|
300
315
|
/**
|
|
301
316
|
* Escapes heading characters in a string.
|
|
302
317
|
* @param {string} text Content to escape
|
|
@@ -305,6 +320,7 @@ class Util extends null {
|
|
|
305
320
|
static escapeHeading(text) {
|
|
306
321
|
return text.replaceAll(/^( {0,2}[*-] +)?(#{1,3} )/gm, '$1\\$2');
|
|
307
322
|
}
|
|
323
|
+
|
|
308
324
|
/**
|
|
309
325
|
* Escapes bulleted list characters in a string.
|
|
310
326
|
* @param {string} text Content to escape
|
|
@@ -313,6 +329,7 @@ class Util extends null {
|
|
|
313
329
|
static escapeBulletedList(text) {
|
|
314
330
|
return text.replaceAll(/^( *)[*-]( +)/gm, '$1\\-$2');
|
|
315
331
|
}
|
|
332
|
+
|
|
316
333
|
/**
|
|
317
334
|
* Escapes numbered list characters in a string.
|
|
318
335
|
* @param {string} text Content to escape
|
|
@@ -321,6 +338,7 @@ class Util extends null {
|
|
|
321
338
|
static escapeNumberedList(text) {
|
|
322
339
|
return text.replaceAll(/^( *\d+)\./gm, '$1\\.');
|
|
323
340
|
}
|
|
341
|
+
|
|
324
342
|
/**
|
|
325
343
|
* Escapes masked link characters in a string.
|
|
326
344
|
* @param {string} text Content to escape
|
|
@@ -330,6 +348,16 @@ class Util extends null {
|
|
|
330
348
|
return text.replaceAll(/\[.+\]\(.+\)/gm, '\\$&');
|
|
331
349
|
}
|
|
332
350
|
|
|
351
|
+
/**
|
|
352
|
+
* @typedef {Object} FetchRecommendedShardsOptions
|
|
353
|
+
* @property {number} [guildsPerShard=1000] Number of guilds assigned per shard
|
|
354
|
+
* @property {number} [multipleOf=1] The multiple the shard count should round up to. (16 for large bot sharding)
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
static fetchRecommendedShards() {
|
|
358
|
+
throw new DiscordError('INVALID_USER_API');
|
|
359
|
+
}
|
|
360
|
+
|
|
333
361
|
/**
|
|
334
362
|
* Parses emoji info out of a string. The string must be one of:
|
|
335
363
|
* * A UTF-8 emoji (no id)
|
|
@@ -619,26 +647,22 @@ class Util extends null {
|
|
|
619
647
|
|
|
620
648
|
/**
|
|
621
649
|
* Resolves the maximum time a guild's thread channels should automatically archive in case of no recent activity.
|
|
622
|
-
* @
|
|
650
|
+
* @param {Guild} guild The guild to resolve this limit from.
|
|
651
|
+
* @deprecated This will be removed in the next major version.
|
|
623
652
|
* @returns {number}
|
|
624
653
|
*/
|
|
625
654
|
static resolveAutoArchiveMaxLimit() {
|
|
655
|
+
if (!deprecationEmittedForResolveAutoArchiveMaxLimit) {
|
|
656
|
+
process.emitWarning(
|
|
657
|
+
// eslint-disable-next-line max-len
|
|
658
|
+
"The Util.resolveAutoArchiveMaxLimit method and the 'MAX' option are deprecated and will be removed in the next major version.",
|
|
659
|
+
'DeprecationWarning',
|
|
660
|
+
);
|
|
661
|
+
deprecationEmittedForResolveAutoArchiveMaxLimit = true;
|
|
662
|
+
}
|
|
626
663
|
return 10080;
|
|
627
664
|
}
|
|
628
665
|
|
|
629
|
-
/**
|
|
630
|
-
* Lazily evaluates a callback function (yea it's v14 :yay:)
|
|
631
|
-
* @param {Function} cb The callback to lazily evaluate
|
|
632
|
-
* @returns {Function}
|
|
633
|
-
* @example
|
|
634
|
-
* const User = lazy(() => require('./User'));
|
|
635
|
-
* const user = new (User())(client, data);
|
|
636
|
-
*/
|
|
637
|
-
static lazy(cb) {
|
|
638
|
-
let defaultValue;
|
|
639
|
-
return () => (defaultValue ??= cb());
|
|
640
|
-
}
|
|
641
|
-
|
|
642
666
|
/**
|
|
643
667
|
* Transforms an API guild forum tag to camel-cased guild forum tag.
|
|
644
668
|
* @param {APIGuildForumTag} tag The tag to transform
|
|
@@ -704,11 +728,44 @@ class Util extends null {
|
|
|
704
728
|
};
|
|
705
729
|
}
|
|
706
730
|
|
|
707
|
-
|
|
708
|
-
|
|
731
|
+
/**
|
|
732
|
+
* Gets an array of the channel types that can be moved in the channel group. For example, a GuildText channel would
|
|
733
|
+
* return an array containing the types that can be ordered within the text channels (always at the top), and a voice
|
|
734
|
+
* channel would return an array containing the types that can be ordered within the voice channels (always at the
|
|
735
|
+
* bottom).
|
|
736
|
+
* @param {ChannelType} type The type of the channel
|
|
737
|
+
* @returns {ChannelType[]}
|
|
738
|
+
* @ignore
|
|
739
|
+
*/
|
|
740
|
+
static getSortableGroupTypes(type) {
|
|
741
|
+
switch (type) {
|
|
742
|
+
case 'GUILD_TEXT':
|
|
743
|
+
case 'GUILD_ANNOUNCEMENT':
|
|
744
|
+
case 'GUILD_FORUM':
|
|
745
|
+
return TextSortableGroupTypes;
|
|
746
|
+
case 'GUILD_VOICE':
|
|
747
|
+
case 'GUILD_STAGE_VOICE':
|
|
748
|
+
return VoiceSortableGroupTypes;
|
|
749
|
+
case 'GUILD_CATEGORY':
|
|
750
|
+
return CategorySortableGroupTypes;
|
|
751
|
+
default:
|
|
752
|
+
return [type];
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Calculates the default avatar index for a given user id.
|
|
758
|
+
* @param {Snowflake} userId - The user id to calculate the default avatar index for
|
|
759
|
+
* @returns {number}
|
|
760
|
+
*/
|
|
761
|
+
static calculateUserDefaultAvatarIndex(userId) {
|
|
762
|
+
return Number(BigInt(userId) >> 22n) % 6;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
static async getUploadURL(client, channelId, files) {
|
|
709
766
|
if (!files.length) return [];
|
|
710
767
|
files = files.map((file, i) => ({
|
|
711
|
-
filename: file.name
|
|
768
|
+
filename: file.name,
|
|
712
769
|
// 25MB = 26_214_400bytes
|
|
713
770
|
file_size: Math.floor((26_214_400 / 10) * Math.random()),
|
|
714
771
|
id: `${i}`,
|
|
@@ -726,6 +783,7 @@ class Util extends null {
|
|
|
726
783
|
fetch(url, {
|
|
727
784
|
method: 'PUT',
|
|
728
785
|
body: data,
|
|
786
|
+
duplex: 'half', // Node.js v20
|
|
729
787
|
})
|
|
730
788
|
.then(res => {
|
|
731
789
|
if (res.ok) {
|
|
@@ -737,24 +795,6 @@ class Util extends null {
|
|
|
737
795
|
.catch(reject);
|
|
738
796
|
});
|
|
739
797
|
}
|
|
740
|
-
|
|
741
|
-
static testImportModule(name) {
|
|
742
|
-
try {
|
|
743
|
-
require.resolve(name);
|
|
744
|
-
return true;
|
|
745
|
-
} catch {
|
|
746
|
-
return false;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* Calculates the default avatar index for a given user id.
|
|
752
|
-
* @param {Snowflake} userId - The user id to calculate the default avatar index for
|
|
753
|
-
* @returns {number}
|
|
754
|
-
*/
|
|
755
|
-
static calculateUserDefaultAvatarIndex(userId) {
|
|
756
|
-
return Number(BigInt(userId) >> 22n) % 6;
|
|
757
|
-
}
|
|
758
798
|
}
|
|
759
799
|
|
|
760
800
|
module.exports = Util;
|
package/typings/enums.d.ts
CHANGED
|
@@ -10,67 +10,6 @@ export const enum ActivityTypes {
|
|
|
10
10
|
COMPETING = 5,
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export const enum DMScanLevel {
|
|
14
|
-
NOT_SCAN = 0,
|
|
15
|
-
NOT_FRIEND = 1,
|
|
16
|
-
EVERYONE = 2,
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const enum stickerAnimationMode {
|
|
20
|
-
ALWAYS = 0,
|
|
21
|
-
INTERACTION = 1,
|
|
22
|
-
NEVER = 2,
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const enum NitroType {
|
|
26
|
-
NONE = 0,
|
|
27
|
-
NITRO_CLASSIC = 1,
|
|
28
|
-
NITRO_BOOST = 2,
|
|
29
|
-
NITRO_BASIC = 3,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const enum RelationshipTypes {
|
|
33
|
-
NONE = 0,
|
|
34
|
-
FRIEND = 1,
|
|
35
|
-
BLOCKED = 2,
|
|
36
|
-
PENDING_INCOMING = 3,
|
|
37
|
-
PENDING_OUTGOING = 4,
|
|
38
|
-
IMPLICIT = 5,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const enum localeSetting {
|
|
42
|
-
DANISH = 'da',
|
|
43
|
-
GERMAN = 'de',
|
|
44
|
-
ENGLISH_UK = 'en-GB',
|
|
45
|
-
ENGLISH_US = 'en-US',
|
|
46
|
-
SPANISH = 'es-ES',
|
|
47
|
-
FRENCH = 'fr',
|
|
48
|
-
CROATIAN = 'hr',
|
|
49
|
-
ITALIAN = 'it',
|
|
50
|
-
LITHUANIAN = 'lt',
|
|
51
|
-
HUNGARIAN = 'hu',
|
|
52
|
-
DUTCH = 'nl',
|
|
53
|
-
NORWEGIAN = 'no',
|
|
54
|
-
POLISH = 'pl',
|
|
55
|
-
BRAZILIAN_PORTUGUESE = 'pt-BR',
|
|
56
|
-
ROMANIA_ROMANIAN = 'ro',
|
|
57
|
-
FINNISH = 'fi',
|
|
58
|
-
SWEDISH = 'sv-SE',
|
|
59
|
-
VIETNAMESE = 'vi',
|
|
60
|
-
TURKISH = 'tr',
|
|
61
|
-
CZECH = 'cs',
|
|
62
|
-
GREEK = 'el',
|
|
63
|
-
BULGARIAN = 'bg',
|
|
64
|
-
RUSSIAN = 'ru',
|
|
65
|
-
UKRAINIAN = 'uk',
|
|
66
|
-
HINDI = 'hi',
|
|
67
|
-
THAI = 'th',
|
|
68
|
-
CHINA_CHINESE = 'zh-CN',
|
|
69
|
-
JAPANESE = 'ja',
|
|
70
|
-
TAIWAN_CHINESE = 'zh-TW',
|
|
71
|
-
KOREAN = 'ko',
|
|
72
|
-
}
|
|
73
|
-
|
|
74
13
|
export const enum ApplicationCommandTypes {
|
|
75
14
|
CHAT_INPUT = 1,
|
|
76
15
|
USER = 2,
|
|
@@ -203,13 +142,6 @@ export const enum GuildScheduledEventStatuses {
|
|
|
203
142
|
CANCELED = 4,
|
|
204
143
|
}
|
|
205
144
|
|
|
206
|
-
export const enum HypeSquadType {
|
|
207
|
-
LEAVE = 0,
|
|
208
|
-
HOUSE_BRAVERY = 1,
|
|
209
|
-
HOUSE_BRILLIANCE = 2,
|
|
210
|
-
HOUSE_BALANCE = 3,
|
|
211
|
-
}
|
|
212
|
-
|
|
213
145
|
export const enum InteractionResponseTypes {
|
|
214
146
|
PONG = 1,
|
|
215
147
|
CHANNEL_MESSAGE_WITH_SOURCE = 4,
|
|
@@ -230,7 +162,15 @@ export const enum InteractionTypes {
|
|
|
230
162
|
|
|
231
163
|
export const enum InviteTargetType {
|
|
232
164
|
STREAM = 1,
|
|
233
|
-
EMBEDDED_APPLICATION
|
|
165
|
+
EMBEDDED_APPLICATION,
|
|
166
|
+
ROLE_SUBSCRIPTIONS,
|
|
167
|
+
CREATOR_PAGE,
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const enum InviteType {
|
|
171
|
+
GUILD,
|
|
172
|
+
GROUP_DM,
|
|
173
|
+
FRIEND,
|
|
234
174
|
}
|
|
235
175
|
|
|
236
176
|
export const enum MembershipStates {
|
|
@@ -249,8 +189,6 @@ export const enum MessageButtonStyles {
|
|
|
249
189
|
export const enum MessageComponentTypes {
|
|
250
190
|
ACTION_ROW = 1,
|
|
251
191
|
BUTTON = 2,
|
|
252
|
-
/** @deprecated Use `STRING_SELECT` instead */
|
|
253
|
-
SELECT_MENU = 3,
|
|
254
192
|
STRING_SELECT = 3,
|
|
255
193
|
TEXT_INPUT = 4,
|
|
256
194
|
USER_SELECT = 5,
|
|
@@ -260,8 +198,6 @@ export const enum MessageComponentTypes {
|
|
|
260
198
|
}
|
|
261
199
|
|
|
262
200
|
export const enum SelectMenuComponentTypes {
|
|
263
|
-
/** @deprecated Use `STRING_SELECT` instead */
|
|
264
|
-
SELECT_MENU = 3,
|
|
265
201
|
STRING_SELECT = 3,
|
|
266
202
|
USER_SELECT = 5,
|
|
267
203
|
ROLE_SELECT = 6,
|
|
@@ -344,3 +280,12 @@ export enum ApplicationRoleConnectionMetadataTypes {
|
|
|
344
280
|
BOOLEAN_EQUAL,
|
|
345
281
|
BOOLEAN_NOT_EQUAL,
|
|
346
282
|
}
|
|
283
|
+
|
|
284
|
+
export const enum RelationshipTypes {
|
|
285
|
+
NONE = 0,
|
|
286
|
+
FRIEND = 1,
|
|
287
|
+
BLOCKED = 2,
|
|
288
|
+
PENDING_INCOMING = 3,
|
|
289
|
+
PENDING_OUTGOING = 4,
|
|
290
|
+
IMPLICIT = 5,
|
|
291
|
+
}
|