refactor(Ready): Update module pls ....

This commit is contained in:
Cinnamon 2022-06-24 09:50:09 +07:00
parent 8b5eac8cf2
commit 5fd081b6dd
2 changed files with 33 additions and 6 deletions

View File

@ -23,14 +23,41 @@ async function checkUpdate(client) {
return client.emit('update', `${chalk.redBright('[Fail]')} Check Update error`);
}
const lastest_tag = res_.data['dist-tags'].latest;
client.emit('update', Discord.version, lastest_tag);
return null;
if (client.options.checkUpdate) {
if (lastest_tag !== Discord.version && Discord.version.includes('-') == false) {
console.log(`${chalk.yellowBright('[WARNING]')} New Discord.js-selfbot-v13 version.
Old Version: ${chalk.redBright(Discord.version)} => New Version: ${chalk.greenBright(lastest_tag)}
If you don't want to show this message, set \`checkUpdate\` to false
new Client({
checkUpdate: false,
});
and use event update
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update`);
} else {
console.log(
`${chalk.greenBright('[OK]')} Discord.js-selfbot-v13 is up to date. Version: ${chalk.blueBright(
Discord.version,
)}
If you don't want to show this message, set \`checkUpdate\` to false
new Client({
checkUpdate: false,
});
and use event update
https://discordjs-self-v13.netlify.app/#/docs/docs/main/class/Client?scrollTo=e-update`,
);
}
}
return client.emit('update', Discord.version, lastest_tag);
}
module.exports = (client, { d: data }, shard) => {
if (client.options.checkUpdate) {
checkUpdate(client);
}
checkUpdate(client);
if (client.options.patchVoice) {
/* eslint-disable */

View File

@ -36,7 +36,7 @@ const JSONBig = require('json-bigint');
* recommended amount of shards from Discord and spawn that amount
* @property {number} [closeTimeout=5000] The amount of time in milliseconds to wait for the close frame to be received
* from the WebSocket. Don't have this too high/low. Its best to have it between 2_000-6_000 ms.
* @property {boolean} [checkUpdate=true] Check for module updates at startup
* @property {boolean} [checkUpdate=true] Display module update information on the screen
* @property {boolean} [readyStatus=true] Sync state with Discord Client
* @property {boolean} [autoCookie=true] Automatically add Cookies to Request on startup
* @property {boolean} [patchVoice=true] Automatically patch @discordjs/voice module (support for call)