From 77a5ac6137c7bcdf3c096bffe0d5b54312aaf4f5 Mon Sep 17 00:00:00 2001 From: Supositware Date: Sun, 7 Jul 2024 00:56:09 +0200 Subject: [PATCH] Move yt-dlp version check to be execute when its needed as to not delay the logs --- events/client/ready.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/events/client/ready.js b/events/client/ready.js index 9396329..7ff5e11 100644 --- a/events/client/ready.js +++ b/events/client/ready.js @@ -9,6 +9,19 @@ export default { // Init global variables. global.boards = {}; + const commandSize = client.commands.size; + const clientTag = client.user.username; + const guildSize = client.guilds.cache.size; + const channelSize = client.channels.cache.size; + const clientID = client.user.id; + + console.log('===========[ READY ]==========='); + console.log(`\x1b[32mLogged in as \x1b[34m${clientTag}\x1b[0m! (\x1b[33m${clientID}\x1b[0m)`); + console.log(`Ready to serve in \x1b[33m${channelSize}\x1b[0m channels on \x1b[33m${guildSize}\x1b[0m servers.`); + console.log(`${client.readyAt}`); + console.log(`There is \x1b[33m${commandSize}\x1b[0m command loaded.`); + console.log(`Running Discord.js \x1b[33m${version}\x1b[0m`); + const ytdlpVersion = await new Promise((resolve, reject) => { execFile('./bin/yt-dlp', ['--version'], (err, stdout, stderr) => { if (err) { @@ -21,19 +34,7 @@ export default { }); }); - const commandSize = client.commands.size; - const clientTag = client.user.username; - const guildSize = client.guilds.cache.size; - const channelSize = client.channels.cache.size; - const clientID = client.user.id; - - console.log('===========[ READY ]==========='); - console.log(`\x1b[32mLogged in as \x1b[34m${clientTag}\x1b[0m! (\x1b[33m${clientID}\x1b[0m)`); - console.log(`Ready to serve in \x1b[33m${channelSize}\x1b[0m channels on \x1b[33m${guildSize}\x1b[0m servers.`); - console.log(`${client.readyAt}`); - console.log(`There is \x1b[33m${commandSize}\x1b[0m command loaded.`); console.log(`Running yt-dlp \x1b[33m${ytdlpVersion.replace('\n', '')}\x1b[0m`); - console.log(`Running Discord.js \x1b[33m${version}\x1b[0m`); console.log('===========[ READY ]==========='); // If stats channel settings exist, send bot stats to it