fix: Still showing log even though checkUpdate is false

This commit is contained in:
Elysia 2023-05-22 19:02:17 +07:00
parent 4b329c8105
commit c902304236
2 changed files with 13 additions and 13 deletions

View File

@ -536,6 +536,7 @@ class Client extends BaseClient {
try {
const latest_tag = res_.data['dist-tags'].latest;
this.emit('update', Discord.version, latest_tag);
this.emit('debug', `${chalk.greenBright('[OK]')} Check Update success`);
} catch {
this.emit('debug', `${chalk.redBright('[Fail]')} Check Update error`);
this.emit('update', Discord.version, false);

View File

@ -42,9 +42,10 @@ function patchVoice(client) {
module.exports = async (client, { d: data }, shard) => {
if (!firstReady) {
client.once('update', (currentVersion, newVersion) => {
if (!newVersion) {
console.log(`
if (client.options.checkUpdate) {
client.once('update', (currentVersion, newVersion) => {
if (!newVersion) {
console.log(`
${chalk.redBright('[WARNING]')} Cannot check new Discord.js-selfbot-v13 version.
Current: ${chalk.blueBright(currentVersion)}
@ -56,8 +57,8 @@ module.exports = async (client, { d: data }, shard) => {
and using event update
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update\n`);
} else if (currentVersion !== newVersion && !currentVersion.includes('-')) {
console.log(`
} else if (currentVersion !== newVersion && !currentVersion.includes('-')) {
console.log(`
${chalk.yellowBright('[WARNING]')} New Discord.js-selfbot-v13 version.
Current: ${chalk.redBright(currentVersion)} => Latest: ${chalk.greenBright(newVersion)}
@ -69,9 +70,9 @@ module.exports = async (client, { d: data }, shard) => {
and using event update
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update\n`);
} else {
console.log(
`
} else {
console.log(
`
${chalk.greenBright('[OK]')} Discord.js-selfbot-v13 is up to date. Current: ${chalk.blueBright(currentVersion)}
If you don't want to show this message, set ${chalk.cyanBright('checkUpdate')} to false
@ -82,11 +83,9 @@ module.exports = async (client, { d: data }, shard) => {
and using event update
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update\n`,
);
}
});
if (client.options.checkUpdate === false) {
);
}
});
client.checkUpdate();
}