|
|
|
@@ -1,7 +1,5 @@
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
const ClientApplication = require('../../../structures/ClientApplication');
|
|
|
|
|
const User = require('../../../structures/User');
|
|
|
|
|
let ClientUser;
|
|
|
|
|
const chalk = require('chalk');
|
|
|
|
|
const axios = require('axios');
|
|
|
|
@@ -17,7 +15,7 @@ const checkUpdate = async () => {
|
|
|
|
|
const lastest_tag = res_.data['dist-tags'].latest;
|
|
|
|
|
// Checking if the package is outdated
|
|
|
|
|
// Stable version
|
|
|
|
|
if (lastest_tag !== Discord.version) {
|
|
|
|
|
if (lastest_tag !== Discord.version && Discord.version.includes('-') == false) {
|
|
|
|
|
return console.log(`${chalk.yellowBright(
|
|
|
|
|
'[WARNING]',
|
|
|
|
|
)} New Discord.js-selfbot-v13 version.
|
|
|
|
@@ -34,15 +32,40 @@ Old Version: ${chalk.redBright(
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const customStatusAuto = async (client) => {
|
|
|
|
|
let custom_status;
|
|
|
|
|
if (
|
|
|
|
|
client.setting.rawSetting.custom_status?.text ||
|
|
|
|
|
res.rawSetting.custom_status?.emoji_name
|
|
|
|
|
) {
|
|
|
|
|
custom_status = new RichPresence.CustomStatus();
|
|
|
|
|
if (client.setting.rawSetting.custom_status.emoji_id) {
|
|
|
|
|
const emoji = await client.emojis.resolve(
|
|
|
|
|
client.setting.rawSetting.custom_status.emoji_id,
|
|
|
|
|
);
|
|
|
|
|
if (emoji) custom_status.setDiscordEmoji(emoji);
|
|
|
|
|
} else {
|
|
|
|
|
custom_status.setUnicodeEmoji(
|
|
|
|
|
client.setting.rawSetting.custom_status.emoji_name,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
custom_status.setState(client.setting.rawSetting.custom_status?.text);
|
|
|
|
|
client.user.setPresence({
|
|
|
|
|
activities: custom_status ? [custom_status.toDiscord()] : [],
|
|
|
|
|
status: client.setting.rawSetting.status,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = (client, { d: data }, shard) => {
|
|
|
|
|
// console.log(data);
|
|
|
|
|
console.log(data);
|
|
|
|
|
if (client.options.checkUpdate) {
|
|
|
|
|
try {
|
|
|
|
|
checkUpdate();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
client.session_id = data.session_id;
|
|
|
|
|
if (client.user) {
|
|
|
|
|
client.user._patch(data.user);
|
|
|
|
@@ -54,29 +77,34 @@ module.exports = (client, { d: data }, shard) => {
|
|
|
|
|
|
|
|
|
|
client.user.setAFK(false);
|
|
|
|
|
|
|
|
|
|
client.setting.fetch().then(async (res) => {
|
|
|
|
|
if (!client.options.readyStatus) throw 'no';
|
|
|
|
|
let custom_status;
|
|
|
|
|
if (
|
|
|
|
|
res.rawSetting.custom_status?.text ||
|
|
|
|
|
res.rawSetting.custom_status?.emoji_name
|
|
|
|
|
) {
|
|
|
|
|
custom_status = new RichPresence.CustomStatus();
|
|
|
|
|
if (res.rawSetting.custom_status.emoji_id) {
|
|
|
|
|
const emoji = await client.emojis.resolve(
|
|
|
|
|
res.rawSetting.custom_status.emoji_id,
|
|
|
|
|
);
|
|
|
|
|
if (emoji) custom_status.setDiscordEmoji(emoji);
|
|
|
|
|
} else {
|
|
|
|
|
custom_status.setUnicodeEmoji(res.rawSetting.custom_status.emoji_name);
|
|
|
|
|
}
|
|
|
|
|
custom_status.setState(res.rawSetting.custom_status?.text);
|
|
|
|
|
client.user.setPresence({
|
|
|
|
|
activities: custom_status ? [custom_status.toDiscord()] : [],
|
|
|
|
|
status: res.rawSetting.status,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
client.setting._patch(data.user_settings);
|
|
|
|
|
|
|
|
|
|
client.user.connectedAccounts = data.connected_accounts ?? [];
|
|
|
|
|
|
|
|
|
|
for (const [userid, note] of Object.entries(data.notes)) {
|
|
|
|
|
client.user.notes.set(userid, note);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (client.options.readyStatus) {
|
|
|
|
|
customStatusAuto(client);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* read_state: Return Array:
|
|
|
|
|
* {
|
|
|
|
|
* mention_count: 14, // ok it's ping count
|
|
|
|
|
* last_pin_timestamp: '1970-01-01T00:00:00+00:00', // why discord ?
|
|
|
|
|
* last_message_id: 0, // :)
|
|
|
|
|
* id: '840218426969817119' // channel id
|
|
|
|
|
* },
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
for (const object of data.read_state) {
|
|
|
|
|
if (object.mention_count == 0) continue;
|
|
|
|
|
client.user.messageMentions.set(object.id, object);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
for (const guild of data.guilds) {
|
|
|
|
|
guild.shardId = shard.id;
|
|
|
|
|