djs-selfbot-v13 3.1.5 → 3.1.7
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 +674 -0
- package/README.md +42 -15
- package/package.json +24 -9
- package/src/client/BaseClient.js +3 -2
- package/src/client/Client.js +539 -187
- package/src/client/actions/Action.js +13 -18
- package/src/client/actions/ActionsManager.js +1 -7
- package/src/client/actions/AutoModerationActionExecution.js +0 -1
- package/src/client/actions/AutoModerationRuleCreate.js +0 -1
- package/src/client/actions/AutoModerationRuleDelete.js +0 -1
- package/src/client/actions/AutoModerationRuleUpdate.js +0 -1
- package/src/client/actions/GuildMemberRemove.js +1 -1
- package/src/client/actions/GuildMemberUpdate.js +1 -1
- package/src/client/actions/InteractionCreate.js +115 -0
- package/src/client/actions/MessageCreate.js +4 -0
- package/src/client/actions/PresenceUpdate.js +16 -17
- package/src/client/websocket/WebSocketManager.js +31 -11
- package/src/client/websocket/WebSocketShard.js +38 -39
- package/src/client/websocket/handlers/APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE.js +23 -0
- 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 +13 -16
- package/src/client/websocket/handlers/CHANNEL_RECIPIENT_REMOVE.js +11 -11
- package/src/client/websocket/handlers/GUILD_APPLICATION_COMMANDS_UPDATE.js +11 -0
- package/src/client/websocket/handlers/GUILD_CREATE.js +0 -7
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.js +1 -1
- package/src/client/websocket/handlers/GUILD_MEMBER_LIST_UPDATE.js +55 -0
- 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 +16 -0
- package/src/client/websocket/handlers/INTERACTION_FAILURE.js +18 -0
- package/src/client/websocket/handlers/INTERACTION_MODAL_CREATE.js +0 -1
- package/src/client/websocket/handlers/INTERACTION_SUCCESS.js +30 -0
- package/src/client/websocket/handlers/MESSAGE_ACK.js +16 -0
- package/src/client/websocket/handlers/READY.js +137 -47
- package/src/client/websocket/handlers/RELATIONSHIP_ADD.js +5 -7
- package/src/client/websocket/handlers/RELATIONSHIP_REMOVE.js +4 -6
- package/src/client/websocket/handlers/RELATIONSHIP_UPDATE.js +9 -32
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.js +0 -0
- package/src/client/websocket/handlers/USER_GUILD_SETTINGS_UPDATE.js +8 -2
- package/src/client/websocket/handlers/USER_NOTE_UPDATE.js +1 -1
- package/src/client/websocket/handlers/USER_SETTINGS_UPDATE.js +5 -1
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js +0 -0
- package/src/client/websocket/handlers/index.js +20 -15
- package/src/errors/Messages.js +69 -24
- package/src/index.js +43 -12
- package/src/managers/ApplicationCommandManager.js +12 -9
- package/src/managers/ApplicationCommandPermissionsManager.js +11 -3
- package/src/managers/ChannelManager.js +4 -2
- package/src/managers/ClientUserSettingManager.js +279 -161
- package/src/managers/DeveloperPortalManager.js +104 -0
- package/src/managers/GuildApplicationCommandManager.js +28 -0
- package/src/managers/GuildBanManager.js +1 -1
- package/src/managers/GuildChannelManager.js +0 -2
- package/src/managers/GuildFolderManager.js +24 -0
- package/src/managers/GuildForumThreadManager.js +28 -22
- package/src/managers/GuildMemberManager.js +216 -40
- package/src/managers/GuildSettingManager.js +15 -22
- package/src/managers/MessageManager.js +44 -42
- package/src/managers/PermissionOverwriteManager.js +1 -1
- package/src/managers/ReactionUserManager.js +5 -5
- package/src/managers/RelationshipManager.js +74 -81
- package/src/managers/SessionManager.js +57 -0
- package/src/managers/ThreadManager.js +45 -12
- package/src/managers/ThreadMemberManager.js +1 -1
- package/src/managers/UserManager.js +10 -6
- package/src/rest/APIRequest.js +20 -42
- package/src/rest/CaptchaSolver.js +132 -0
- package/src/rest/DiscordAPIError.js +16 -17
- package/src/rest/RESTManager.js +21 -1
- package/src/rest/RequestHandler.js +21 -35
- package/src/structures/ApplicationCommand.js +456 -19
- package/src/structures/ApplicationRoleConnectionMetadata.js +0 -3
- package/src/structures/AutoModerationRule.js +5 -5
- package/src/structures/AutocompleteInteraction.js +0 -1
- package/src/structures/BaseGuildTextChannel.js +12 -10
- package/src/structures/BaseGuildVoiceChannel.js +18 -16
- package/src/structures/{CallState.js → Call.js} +12 -17
- package/src/structures/CategoryChannel.js +0 -2
- package/src/structures/Channel.js +3 -2
- package/src/structures/ClientApplication.js +204 -0
- package/src/structures/ClientPresence.js +8 -12
- package/src/structures/ClientUser.js +338 -117
- package/src/structures/ContextMenuInteraction.js +1 -1
- package/src/structures/DMChannel.js +92 -29
- package/src/structures/DeveloperPortalApplication.js +520 -0
- package/src/structures/ForumChannel.js +10 -0
- package/src/structures/Guild.js +271 -135
- package/src/structures/GuildAuditLogs.js +5 -0
- package/src/structures/GuildChannel.js +2 -16
- package/src/structures/GuildFolder.js +75 -0
- package/src/structures/GuildMember.js +145 -27
- package/src/structures/Interaction.js +62 -1
- package/src/structures/InteractionResponse.js +114 -0
- package/src/structures/Invite.js +52 -35
- package/src/structures/Message.js +202 -222
- package/src/structures/MessageAttachment.js +0 -11
- package/src/structures/MessageButton.js +67 -1
- package/src/structures/MessageEmbed.js +1 -1
- package/src/structures/MessageMentions.js +2 -3
- package/src/structures/MessagePayload.js +46 -4
- package/src/structures/MessageReaction.js +1 -1
- package/src/structures/MessageSelectMenu.js +252 -1
- package/src/structures/Modal.js +180 -75
- package/src/structures/PartialGroupDMChannel.js +433 -0
- package/src/structures/Presence.js +2 -2
- package/src/structures/RichPresence.js +34 -14
- package/src/structures/Role.js +2 -18
- package/src/structures/SelectMenuInteraction.js +151 -2
- package/src/structures/Session.js +81 -0
- package/src/structures/Team.js +49 -0
- package/src/structures/TextInputComponent.js +70 -0
- package/src/structures/ThreadChannel.js +19 -0
- package/src/structures/User.js +345 -117
- package/src/structures/UserContextMenuInteraction.js +2 -2
- package/src/structures/VoiceState.js +39 -74
- package/src/structures/WebEmbed.js +52 -38
- package/src/structures/Webhook.js +11 -17
- package/src/structures/interfaces/Application.js +23 -146
- package/src/structures/interfaces/TextBasedChannel.js +256 -411
- package/src/util/ApplicationFlags.js +1 -1
- package/src/util/Constants.js +284 -106
- package/src/util/Formatters.js +2 -16
- package/src/util/LimitedCollection.js +1 -1
- package/src/util/Options.js +68 -48
- package/src/util/Permissions.js +0 -5
- package/src/util/PurchasedFlags.js +0 -2
- package/src/util/RemoteAuth.js +356 -221
- package/src/util/Sweepers.js +1 -1
- package/src/util/Util.js +36 -76
- package/src/util/Voice.js +1456 -0
- package/src/util/arRPC/index.js +229 -0
- package/src/util/arRPC/process/detectable.json +1 -0
- package/src/util/arRPC/process/index.js +102 -0
- package/src/util/arRPC/process/native/index.js +5 -0
- package/src/util/arRPC/process/native/linux.js +37 -0
- package/src/util/arRPC/process/native/win32.js +25 -0
- package/src/util/arRPC/transports/ipc.js +281 -0
- package/src/util/arRPC/transports/websocket.js +128 -0
- package/typings/enums.d.ts +73 -18
- package/typings/index.d.ts +1250 -898
- package/typings/rawDataTypes.d.ts +9 -68
- package/src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.js +0 -78
- package/src/client/websocket/handlers/VOICE_CHANNEL_STATUS_UPDATE.js +0 -12
- package/src/managers/UserNoteManager.js +0 -53
- package/src/structures/GroupDMChannel.js +0 -387
- package/src/util/AttachmentFlags.js +0 -38
- package/src/util/InviteFlags.js +0 -29
- package/src/util/RoleFlags.js +0 -37
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const { Events } = require('../../../util/Constants');
|
|
3
3
|
module.exports = (client, packet) => {
|
|
4
|
+
/**
|
|
5
|
+
* Emitted whenever a recipient is removed from a group DM.
|
|
6
|
+
* @event Client#channelRecipientRemove
|
|
7
|
+
* @param {PartialGroupDMChannel} channel Group DM channel
|
|
8
|
+
* @param {User} user User
|
|
9
|
+
*/
|
|
4
10
|
const channel = client.channels.cache.get(packet.d.channel_id);
|
|
5
|
-
if (channel)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @event Client#channelRecipientRemove
|
|
11
|
-
* @param {GroupDMChannel} channel Group DM channel
|
|
12
|
-
* @param {User} user User
|
|
13
|
-
*/
|
|
14
|
-
client.emit(Events.CHANNEL_RECIPIENT_REMOVE, channel, client.users._add(packet.d.user));
|
|
15
|
-
}
|
|
11
|
+
if (!channel) return;
|
|
12
|
+
if (!channel._recipients) channel._recipients = [];
|
|
13
|
+
channel._recipients = channel._recipients.filter(r => r !== packet.d.user.id);
|
|
14
|
+
const user = client.users._add(packet.d.user);
|
|
15
|
+
client.emit(Events.CHANNEL_RECIPIENT_REMOVE, channel, user);
|
|
16
16
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { Events } = require('../../../util/Constants');
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
for (const command of data.application_commands) {
|
|
6
|
+
const user = client.users.cache.get(command.application_id);
|
|
7
|
+
if (!user || !user.bot) continue;
|
|
8
|
+
user.application?.commands?._add(command, true);
|
|
9
|
+
}
|
|
10
|
+
client.emit(Events.GUILD_APPLICATION_COMMANDS_UPDATE, data);
|
|
11
|
+
};
|
|
@@ -28,13 +28,6 @@ module.exports = (client, { d: data }, shard) => {
|
|
|
28
28
|
// A newly available guild
|
|
29
29
|
guild._patch(data);
|
|
30
30
|
run(client, guild);
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Emitted whenever a guild becomes available.
|
|
34
|
-
* @event Client#guildAvailable
|
|
35
|
-
* @param {Guild} guild The guild that became available
|
|
36
|
-
*/
|
|
37
|
-
client.emit(Events.GUILD_AVAILABLE, guild);
|
|
38
31
|
}
|
|
39
32
|
} else {
|
|
40
33
|
// A new guild
|
|
@@ -12,7 +12,7 @@ module.exports = (client, { d: data }, shard) => {
|
|
|
12
12
|
* Emitted whenever a user joins a guild.
|
|
13
13
|
* @event Client#guildMemberAdd
|
|
14
14
|
* @param {GuildMember} member The member that has joined a guild
|
|
15
|
-
|
|
15
|
+
* @deprecated See {@link https://github.com/aiko-chan-ai/discord.js-selfbot-v13/issues/197 this issue} for more information.
|
|
16
16
|
*/
|
|
17
17
|
client.emit(Events.GUILD_MEMBER_ADD, member);
|
|
18
18
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Collection } = require('@discordjs/collection');
|
|
4
|
+
const { Events } = require('../../../util/Constants');
|
|
5
|
+
|
|
6
|
+
module.exports = (client, { d: data }) => {
|
|
7
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
8
|
+
if (!guild) return;
|
|
9
|
+
const members = new Collection();
|
|
10
|
+
// Get Member from side Discord Channel (online counting if large server)
|
|
11
|
+
for (const object of data.ops) {
|
|
12
|
+
switch (object.op) {
|
|
13
|
+
case 'SYNC': {
|
|
14
|
+
for (const member_ of object.items) {
|
|
15
|
+
const member = member_.member;
|
|
16
|
+
if (!member) continue;
|
|
17
|
+
members.set(member.user.id, guild.members._add(member));
|
|
18
|
+
if (member.presence) {
|
|
19
|
+
guild.presences._add(Object.assign(member.presence, { guild }));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case 'INVALIDATE': {
|
|
25
|
+
client.emit(
|
|
26
|
+
Events.DEBUG,
|
|
27
|
+
`Invalidate [${object.range[0]}, ${object.range[1]}], Fetching GuildId: ${data.guild_id}`,
|
|
28
|
+
);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case 'UPDATE':
|
|
32
|
+
case 'INSERT': {
|
|
33
|
+
const member = object.item.member;
|
|
34
|
+
if (!member) continue;
|
|
35
|
+
members.set(member.user.id, guild.members._add(member));
|
|
36
|
+
if (member.presence) {
|
|
37
|
+
guild.presences._add(Object.assign(member.presence, { guild }));
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'DELETE': {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Emitted whenever a guild member list (sidebar) is updated.
|
|
48
|
+
* @event Client#guildMemberListUpdate
|
|
49
|
+
* @param {Collection<Snowflake, GuildMember>} members Members that were updated
|
|
50
|
+
* @param {Guild} guild Guild
|
|
51
|
+
* @param {string} type Type of update (INVALIDATE | UPDATE | INSERT | DELETE | SYNC)
|
|
52
|
+
* @param {data} raw Raw data
|
|
53
|
+
*/
|
|
54
|
+
client.emit(Events.GUILD_MEMBER_LIST_UPDATE, members, guild, data.ops[0].op, data);
|
|
55
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { Events } = require('../../../util/Constants');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} InteractionResponseBody
|
|
6
|
+
* @property {Snowflake} id Interaction ID
|
|
7
|
+
* @property {Snowflake} nonce nonce in POST /interactions
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
module.exports = (client, { d: data }) => {
|
|
11
|
+
if (client.user.bot) {
|
|
12
|
+
client.actions.InteractionCreate.handle(data);
|
|
13
|
+
} else {
|
|
14
|
+
client.emit(Events.INTERACTION_CREATE, data);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { Events } = require('../../../util/Constants');
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
/**
|
|
6
|
+
* Emitted whenever client user send interaction and error
|
|
7
|
+
* @event Client#interactionFailure
|
|
8
|
+
* @param {InteractionResponseBody} data data
|
|
9
|
+
*/
|
|
10
|
+
client.emit(Events.INTERACTION_FAILURE, data);
|
|
11
|
+
client.emit('interactionResponse', {
|
|
12
|
+
status: false,
|
|
13
|
+
metadata: client._interactionCache.get(data.nonce),
|
|
14
|
+
error: 'No response from bot',
|
|
15
|
+
});
|
|
16
|
+
// Delete cache
|
|
17
|
+
client._interactionCache.delete(data.nonce);
|
|
18
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { Events } = require('../../../util/Constants');
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
/**
|
|
6
|
+
* Emitted whenever client user send interaction and success
|
|
7
|
+
* @event Client#interactionSuccess
|
|
8
|
+
* @param {InteractionResponseBody} data data
|
|
9
|
+
*/
|
|
10
|
+
client.emit(Events.INTERACTION_SUCCESS, data);
|
|
11
|
+
// Get channel data
|
|
12
|
+
const cache = client._interactionCache.get(data.nonce);
|
|
13
|
+
if (!cache) return;
|
|
14
|
+
const channel = cache.guildId
|
|
15
|
+
? client.guilds.cache.get(cache.guildId)?.channels.cache.get(cache.channelId)
|
|
16
|
+
: client.channels.cache.get(cache.channelId);
|
|
17
|
+
// Set data
|
|
18
|
+
const interaction = {
|
|
19
|
+
...cache,
|
|
20
|
+
...data,
|
|
21
|
+
};
|
|
22
|
+
const data_ = channel.interactions._add(interaction);
|
|
23
|
+
client.emit('interactionResponse', {
|
|
24
|
+
status: true,
|
|
25
|
+
metadata: data_,
|
|
26
|
+
error: 'Success',
|
|
27
|
+
});
|
|
28
|
+
// Delete cache
|
|
29
|
+
// client._interactionCache.delete(data.nonce);
|
|
30
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Events } = require('../../../util/Constants');
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const channel = client.channels.cache.get(data.channel_id);
|
|
7
|
+
/**
|
|
8
|
+
* Emitted whenever message is acknowledged (mark read / unread)
|
|
9
|
+
* @event Client#messageAck
|
|
10
|
+
* @param {TextChannel} channel Channel
|
|
11
|
+
* @param {Snowflake} message_id Message ID
|
|
12
|
+
* @param {boolean} isRead Whether the message is read
|
|
13
|
+
* @param {Object} raw Raw data
|
|
14
|
+
*/
|
|
15
|
+
client.emit(Events.MESSAGE_ACK, channel, data.message_id, !data.manual, data);
|
|
16
|
+
};
|
|
@@ -1,14 +1,105 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const USER_REQUIRED_ACTION = require('./USER_REQUIRED_ACTION_UPDATE');
|
|
4
|
-
const { Opcodes } = require('../../../util/Constants');
|
|
5
|
-
|
|
6
3
|
let ClientUser;
|
|
4
|
+
const { VoiceConnection } = require('@discordjs/voice');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
const { Events, Opcodes } = require('../../../util/Constants');
|
|
7
|
+
const { VoiceConnection: VoiceConnection_patch } = require('../../../util/Voice');
|
|
8
|
+
let firstReady = false;
|
|
9
|
+
|
|
10
|
+
function patchVoice(client) {
|
|
11
|
+
try {
|
|
12
|
+
/* eslint-disable */
|
|
13
|
+
VoiceConnection.prototype.configureNetworking = VoiceConnection_patch.prototype.configureNetworking;
|
|
14
|
+
client.emit(
|
|
15
|
+
'debug',
|
|
16
|
+
`${chalk.greenBright('[OK]')} Patched ${chalk.cyanBright(
|
|
17
|
+
'VoiceConnection.prototype.configureNetworking',
|
|
18
|
+
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.16.0')}]`,
|
|
19
|
+
);
|
|
20
|
+
/* eslint-enable */
|
|
21
|
+
} catch (e) {
|
|
22
|
+
client.emit(
|
|
23
|
+
'debug',
|
|
24
|
+
`${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright(
|
|
25
|
+
'VoiceConnection.prototype.configureNetworking',
|
|
26
|
+
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.16.0')}]\n${e.stack}`,
|
|
27
|
+
);
|
|
28
|
+
client.emit(
|
|
29
|
+
Events.ERROR,
|
|
30
|
+
`${chalk.redBright('[Fail]')} Patched ${chalk.cyanBright(
|
|
31
|
+
'VoiceConnection.prototype.configureNetworking',
|
|
32
|
+
)} [${chalk.bgMagentaBright('@discordjs/voice')} - ${chalk.redBright('v0.16.0')}]`,
|
|
33
|
+
);
|
|
34
|
+
client.emit(
|
|
35
|
+
Events.ERROR,
|
|
36
|
+
`${chalk.redBright('[Error]')} Please install ${chalk.bgMagentaBright(
|
|
37
|
+
'@discordjs/voice',
|
|
38
|
+
)} version ${chalk.redBright('v0.16.0')}`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = async (client, { d: data }, shard) => {
|
|
44
|
+
if (!firstReady) {
|
|
45
|
+
if (client.options.checkUpdate) {
|
|
46
|
+
client.once('update', (currentVersion, newVersion) => {
|
|
47
|
+
if (!newVersion) {
|
|
48
|
+
console.log(`
|
|
49
|
+
${chalk.redBright('[WARNING]')} Cannot check new djs-selfbot-v13 version.
|
|
50
|
+
Current: ${chalk.blueBright(currentVersion)}
|
|
51
|
+
|
|
52
|
+
If you don't want to show this message, set ${chalk.cyanBright('checkUpdate')} to false
|
|
53
|
+
|
|
54
|
+
const client = new Client({
|
|
55
|
+
checkUpdate: false,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
and using event update
|
|
59
|
+
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update\n`);
|
|
60
|
+
} else if (currentVersion !== newVersion && !currentVersion.includes('-')) {
|
|
61
|
+
console.log(`
|
|
62
|
+
${chalk.yellowBright('[WARNING]')} New djs-selfbot-v13 version.
|
|
63
|
+
Current: ${chalk.redBright(currentVersion)} => Latest: ${chalk.greenBright(newVersion)}
|
|
64
|
+
|
|
65
|
+
If you don't want to show this message, set ${chalk.cyanBright('checkUpdate')} to false
|
|
66
|
+
|
|
67
|
+
const client = new Client({
|
|
68
|
+
checkUpdate: false,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
and using event update
|
|
72
|
+
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update\n`);
|
|
73
|
+
} else {
|
|
74
|
+
console.log(
|
|
75
|
+
`
|
|
76
|
+
${chalk.greenBright('[OK]')} djs-selfbot-v13 is up to date. Current: ${chalk.blueBright(currentVersion)}
|
|
77
|
+
|
|
78
|
+
If you don't want to show this message, set ${chalk.cyanBright('checkUpdate')} to false
|
|
79
|
+
|
|
80
|
+
const client = new Client({
|
|
81
|
+
checkUpdate: false,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
and using event update
|
|
85
|
+
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update\n`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
client.checkUpdate();
|
|
90
|
+
}
|
|
7
91
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
92
|
+
if (client.options.patchVoice) {
|
|
93
|
+
patchVoice(client);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (client.options.syncStatus) {
|
|
97
|
+
client.customStatusAuto(client);
|
|
98
|
+
}
|
|
99
|
+
firstReady = true;
|
|
100
|
+
}
|
|
11
101
|
|
|
102
|
+
client.session_id = data.session_id;
|
|
12
103
|
if (client.user) {
|
|
13
104
|
client.user._patch(data.user);
|
|
14
105
|
} else {
|
|
@@ -17,8 +108,31 @@ module.exports = (client, { d: data }, shard) => {
|
|
|
17
108
|
client.users.cache.set(client.user.id, client.user);
|
|
18
109
|
}
|
|
19
110
|
|
|
111
|
+
client.settings._patch(data.user_settings);
|
|
112
|
+
|
|
113
|
+
client.user.connectedAccounts = data.connected_accounts ?? [];
|
|
114
|
+
|
|
115
|
+
client.relationships._setup(data.relationships);
|
|
116
|
+
|
|
117
|
+
client.user._patchNote(data.notes);
|
|
118
|
+
|
|
119
|
+
const syncTime = Date.now();
|
|
20
120
|
for (const private_channel of data.private_channels) {
|
|
21
|
-
client.channels._add(private_channel);
|
|
121
|
+
const channel = client.channels._add(private_channel);
|
|
122
|
+
// Rate limit warning
|
|
123
|
+
if (client.options.DMSync) {
|
|
124
|
+
client.ws.broadcast({
|
|
125
|
+
op: Opcodes.DM_UPDATE,
|
|
126
|
+
d: {
|
|
127
|
+
channel_id: channel.id,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (client.options.DMSync) {
|
|
133
|
+
console.warn(
|
|
134
|
+
`Gateway Rate Limit Warning: Sending ${data.private_channels.length} Requests / ${Date.now() - syncTime || 1} ms`,
|
|
135
|
+
);
|
|
22
136
|
}
|
|
23
137
|
|
|
24
138
|
for (const guild of data.guilds) {
|
|
@@ -26,55 +140,31 @@ module.exports = (client, { d: data }, shard) => {
|
|
|
26
140
|
client.guilds._add(guild);
|
|
27
141
|
}
|
|
28
142
|
|
|
29
|
-
const largeGuilds = data.guilds.filter(g => g.large);
|
|
30
|
-
client.emit('debug', `[READY] Received ${data.guilds.length} guilds, ${largeGuilds.length} large guilds`);
|
|
31
|
-
|
|
32
|
-
// User Notes
|
|
33
|
-
client.notes._reload(data.notes);
|
|
34
|
-
|
|
35
|
-
// Relationship
|
|
36
|
-
client.relationships._setup(data.relationships);
|
|
37
|
-
|
|
38
|
-
// ClientSetting
|
|
39
|
-
client.settings._patch(data.user_settings);
|
|
40
|
-
|
|
41
|
-
// GuildSetting
|
|
42
143
|
for (const gSetting of Array.isArray(data.user_guild_settings) ? data.user_guild_settings : []) {
|
|
43
144
|
const guild = client.guilds.cache.get(gSetting.guild_id);
|
|
44
145
|
if (guild) guild.settings._patch(gSetting);
|
|
45
146
|
}
|
|
46
|
-
// Todo: data.auth_session_id_hash
|
|
47
147
|
|
|
48
|
-
|
|
148
|
+
const largeGuilds = data.guilds.filter(g => g.large);
|
|
149
|
+
|
|
150
|
+
client.emit('debug', `[READY] Received ${data.guilds.length} guilds, ${largeGuilds.length} large guilds`);
|
|
151
|
+
|
|
152
|
+
// Receive messages in large guilds
|
|
153
|
+
for (const guild of largeGuilds) {
|
|
154
|
+
await client.sleep(client.options.messageCreateEventGuildTimeout);
|
|
49
155
|
client.ws.broadcast({
|
|
50
|
-
op: Opcodes.
|
|
156
|
+
op: Opcodes.GUILD_SUBSCRIPTIONS,
|
|
51
157
|
d: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
members: [],
|
|
60
|
-
channels: {},
|
|
61
|
-
};
|
|
62
|
-
return accumulator;
|
|
63
|
-
}, {}),
|
|
158
|
+
guild_id: guild.id,
|
|
159
|
+
typing: true,
|
|
160
|
+
threads: true,
|
|
161
|
+
activities: true,
|
|
162
|
+
thread_member_lists: [],
|
|
163
|
+
members: [],
|
|
164
|
+
channels: {},
|
|
64
165
|
},
|
|
65
166
|
});
|
|
66
167
|
}
|
|
67
168
|
|
|
68
|
-
|
|
69
|
-
data.private_channels.map(async (c, index) => {
|
|
70
|
-
if (client.options.DMChannelVoiceStatusSync < 1) return;
|
|
71
|
-
client.ws.broadcast({
|
|
72
|
-
op: Opcodes.DM_UPDATE,
|
|
73
|
-
d: {
|
|
74
|
-
channel_id: c.id,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
await client.sleep(client.options.DMChannelVoiceStatusSync * index);
|
|
78
|
-
}),
|
|
79
|
-
).then(() => shard.checkReady());
|
|
169
|
+
shard.checkReady();
|
|
80
170
|
};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { Events } = require('../../../util/Constants');
|
|
3
|
+
const { Events, RelationshipTypes } = require('../../../util/Constants');
|
|
4
4
|
|
|
5
5
|
module.exports = (client, { d: data }) => {
|
|
6
6
|
if (data.user) {
|
|
7
7
|
client.users._add(data.user);
|
|
8
8
|
}
|
|
9
9
|
client.relationships.cache.set(data.id, data.type);
|
|
10
|
-
client.relationships.friendNicknames.set(data.id, data.nickname);
|
|
11
|
-
client.relationships.sinceCache.set(data.id, new Date(data.since || 0));
|
|
12
10
|
/**
|
|
13
|
-
* Emitted
|
|
11
|
+
* Emitted whenever a relationship is updated.
|
|
14
12
|
* @event Client#relationshipAdd
|
|
15
|
-
* @param {Snowflake} user
|
|
16
|
-
* @param {
|
|
13
|
+
* @param {Snowflake} user The userID that was updated
|
|
14
|
+
* @param {RelationshipTypes} type The new relationship type
|
|
17
15
|
*/
|
|
18
|
-
client.emit(Events.RELATIONSHIP_ADD, data.id,
|
|
16
|
+
client.emit(Events.RELATIONSHIP_ADD, data.id, RelationshipTypes[data.type]);
|
|
19
17
|
};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { Events } = require('../../../util/Constants');
|
|
3
|
+
const { Events, RelationshipTypes } = require('../../../util/Constants');
|
|
4
4
|
|
|
5
5
|
module.exports = (client, { d: data }) => {
|
|
6
6
|
client.relationships.cache.delete(data.id);
|
|
7
|
-
client.
|
|
8
|
-
client.relationships.sinceCache.delete(data.id);
|
|
7
|
+
client.user.friendNicknames.delete(data.id);
|
|
9
8
|
/**
|
|
10
|
-
* Emitted
|
|
9
|
+
* Emitted whenever a relationship is delete.
|
|
11
10
|
* @event Client#relationshipRemove
|
|
12
11
|
* @param {Snowflake} user The userID that was updated
|
|
13
12
|
* @param {RelationshipTypes} type The type of the old relationship
|
|
14
|
-
* @param {string | null} nickname The nickname of the user in this relationship (1-32 characters)
|
|
15
13
|
*/
|
|
16
|
-
client.emit(Events.RELATIONSHIP_REMOVE, data.id, data.type
|
|
14
|
+
client.emit(Events.RELATIONSHIP_REMOVE, data.id, RelationshipTypes[data.type]);
|
|
17
15
|
};
|
|
@@ -1,41 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { Events } = require('../../../util/Constants');
|
|
3
|
+
const { Events, RelationshipTypes } = require('../../../util/Constants');
|
|
4
4
|
|
|
5
5
|
module.exports = (client, { d: data }) => {
|
|
6
|
+
client.relationships.cache.set(data.id, data.type);
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @property {RelationshipTypes} type The type of relationship
|
|
9
|
-
* @property {Date} since When the user requested a relationship
|
|
10
|
-
* @property {string | null} nickname The nickname of the user in this relationship (1-32 characters)
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Emitted when a relationship is updated, relevant to the current user (e.g. friend nickname changed).
|
|
14
|
-
* <info>This is not sent when the type of a relationship changes; see {@link Client#relationshipAdd} and {@link Client#relationshipRemove} for that.</info>
|
|
8
|
+
* Emitted whenever a relationship is updated.
|
|
15
9
|
* @event Client#relationshipUpdate
|
|
16
10
|
* @param {Snowflake} user The userID that was updated
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
11
|
+
* @param {RelationshipTypes} type The new relationship type
|
|
12
|
+
* @param {Object} data The raw data
|
|
19
13
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (data.type) client.relationships.cache.set(data.id, data.type);
|
|
25
|
-
if (data.nickname) client.relationships.friendNicknames.set(data.id, data.nickname);
|
|
26
|
-
if (data.since) client.relationships.sinceCache.set(data.id, new Date(data.since || 0));
|
|
27
|
-
client.emit(
|
|
28
|
-
Events.RELATIONSHIP_UPDATE,
|
|
29
|
-
data.id,
|
|
30
|
-
{
|
|
31
|
-
type: oldType,
|
|
32
|
-
nickname: oldNickname,
|
|
33
|
-
since: oldSince,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: data.type,
|
|
37
|
-
nickname: data.nickname,
|
|
38
|
-
since: new Date(data.since || 0),
|
|
39
|
-
},
|
|
40
|
-
);
|
|
14
|
+
if ('nickname' in data) {
|
|
15
|
+
client.user.friendNicknames.set(data.id, data.nickname);
|
|
16
|
+
}
|
|
17
|
+
client.emit(Events.RELATIONSHIP_UPDATE, data.id, RelationshipTypes[data.type], data);
|
|
41
18
|
};
|
|
File without changes
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
2
|
+
const { Events } = require('../../../util/Constants');
|
|
3
3
|
module.exports = (client, { d: data }) => {
|
|
4
4
|
const guild = client.guilds.cache.get(data.guild_id);
|
|
5
|
-
|
|
5
|
+
guild?.settings._patch(data);
|
|
6
|
+
/**
|
|
7
|
+
* Emitted whenever guild settings are updated
|
|
8
|
+
* @event Client#userGuildSettingsUpdate
|
|
9
|
+
* @param {Guild} guild Guild
|
|
10
|
+
*/
|
|
11
|
+
return client.emit(Events.USER_GUILD_SETTINGS_UPDATE, guild);
|
|
6
12
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
2
|
+
const { Events } = require('../../../util/Constants');
|
|
3
3
|
module.exports = (client, { d: data }) => {
|
|
4
4
|
client.settings._patch(data);
|
|
5
|
+
if (('status' in data || 'custom_status' in data) && client.options.syncStatus) {
|
|
6
|
+
client.customStatusAuto(client);
|
|
7
|
+
}
|
|
8
|
+
return client.emit(Events.USER_SETTINGS_UPDATE, data);
|
|
5
9
|
};
|
|
File without changes
|