fix: Spam log when client ready

This commit is contained in:
March 7th 2022-07-16 15:31:44 +07:00
parent 11fff76625
commit 4436e0ee85

View File

@ -7,7 +7,7 @@ const chalk = require('chalk');
const Discord = require('../../../index'); const Discord = require('../../../index');
const { Events, Opcodes } = require('../../../util/Constants'); const { Events, Opcodes } = require('../../../util/Constants');
const { Networking } = require('../../../util/Voice'); const { Networking } = require('../../../util/Voice');
let running = false;
/** /**
* Emitted whenever clientOptions.checkUpdate = true * Emitted whenever clientOptions.checkUpdate = true
* @event Client#update * @event Client#update
@ -25,6 +25,7 @@ async function checkUpdate(client) {
const lastest_tag = res_.data['dist-tags'].latest; const lastest_tag = res_.data['dist-tags'].latest;
if (client.options.checkUpdate) { if (client.options.checkUpdate) {
if (lastest_tag !== Discord.version && Discord.version.includes('-') == false) { if (lastest_tag !== Discord.version && Discord.version.includes('-') == false) {
if (!running) {
console.log(` console.log(`
${chalk.yellowBright('[WARNING]')} New Discord.js-selfbot-v13 version. ${chalk.yellowBright('[WARNING]')} New Discord.js-selfbot-v13 version.
Current: ${chalk.redBright(Discord.version)} => Latest: ${chalk.greenBright(lastest_tag)} Current: ${chalk.redBright(Discord.version)} => Latest: ${chalk.greenBright(lastest_tag)}
@ -37,7 +38,8 @@ async function checkUpdate(client) {
and using event update and using event update
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update`); https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update`);
} else { }
} else if (!running) {
console.log( console.log(
` `
${chalk.greenBright('[OK]')} Discord.js-selfbot-v13 is up to date. Current: ${chalk.blueBright(Discord.version)} ${chalk.greenBright('[OK]')} Discord.js-selfbot-v13 is up to date. Current: ${chalk.blueBright(Discord.version)}
@ -59,7 +61,7 @@ async function checkUpdate(client) {
module.exports = (client, { d: data }, shard) => { module.exports = (client, { d: data }, shard) => {
checkUpdate(client); checkUpdate(client);
if (client.options.patchVoice) { if (client.options.patchVoice && !running) {
/* eslint-disable */ /* eslint-disable */
VoiceConnection.prototype.configureNetworking = function () { VoiceConnection.prototype.configureNetworking = function () {
const { server, state } = this.packets; const { server, state } = this.packets;
@ -125,7 +127,7 @@ module.exports = (client, { d: data }, shard) => {
} }
// Remove event because memory leak // Remove event because memory leak
if (client.options.readyStatus) { if (client.options.readyStatus && !running) {
client.customStatusAuto(client); client.customStatusAuto(client);
} }
@ -173,4 +175,6 @@ module.exports = (client, { d: data }, shard) => {
client.relationships._setup(data.relationships); client.relationships._setup(data.relationships);
shard.checkReady(); shard.checkReady();
running = true;
}; };