import { exec } from 'node:child_process' ;
const { statusChannel , NODE _ENV } = process . env ;
export default {
name : 'ready' ,
once : true ,
async execute ( client ) {
const ytdlpVersion = await new Promise ( ( resolve , reject ) => {
exec ( './bin/yt-dlp --version' , ( err , stdout , stderr ) => {
if ( err ) {
reject ( stderr ) ;
}
if ( stderr ) {
console . error ( stderr ) ;
}
resolve ( stdout ) ;
} ) ;
} ) ;
const commandSize = client . commands . size ;
const clientTag = client . user . tag ;
const guildSize = client . guilds . cache . size ;
const channelSize = client . channels . cache . size ;
const clientID = client . user . id ;
console . log ( '===========[ READY ]===========' ) ;
console . log ( ` \x 1b[32mLogged in as \x 1b[34m ${ clientTag } \x 1b[0m! ( \x 1b[33m ${ clientID } \x 1b[0m) ` ) ;
console . log ( ` Ready to serve in \x 1b[33m ${ channelSize } \x 1b[0m channels on \x 1b[33m ${ guildSize } \x 1b[0m servers. ` ) ;
console . log ( ` ${ client . readyAt } ` ) ;
console . log ( ` There is \x 1b[33m ${ commandSize } \x 1b[0m command loaded. ` ) ;
console . log ( ` Running yt-dlp \x 1b[33m ${ ytdlpVersion . replace ( '\n' , '' ) } \x 1b[0m ` ) ;
console . log ( '===========[ READY ]===========' ) ;
// If stats channel settings exist, send bot stats to it
if ( statusChannel && NODE _ENV !== 'development' ) {
const channel = client . channels . resolve ( statusChannel ) ;
channel . send ( ` Ready to serve in ${ channelSize } channels on ${ guildSize } servers. \n There is ${ commandSize } command loaded. \n Running yt-dlp ${ ytdlpVersion . replace ( '\n' , '' ) } \n ${ client . readyAt } ` ) ;
}
} ,
} ;