@ -1,5 +1,5 @@
const { Listener } = require ( 'discord-akairo' ) ;
const { Listener } = require ( 'discord-akairo' ) ;
const { prefix , statsChannel } = require ( '../../config.json' ) ;
const { prefix , statsChannel , botID } = require ( '../../config.json' ) ;
const game = require ( '../../json/status/playing.json' ) ;
const game = require ( '../../json/status/playing.json' ) ;
const watch = require ( '../../json/status/watching.json' ) ;
const watch = require ( '../../json/status/watching.json' ) ;
@ -33,12 +33,28 @@ class ReadyListener extends Listener {
this . client . user . setActivity ( ` ${ status } | ${ prefix [ 0 ] } help ` , { type : 'PLAYING' } ) ;
this . client . user . setActivity ( ` ${ status } | ${ prefix [ 0 ] } help ` , { type : 'PLAYING' } ) ;
}
}
// Send stats to the 'stats' channel in the support server if its not the test bot
// Send stats to the 'stats' channel in the support server if its not the test bot
if ( this . client . user . id == 377563711927484418 ) {
if ( this . client . user . id == botID ) {
const channel = this . client . channels . get ( statsChannel ) ;
const channel = this . client . channels . get ( statsChannel ) ;
channel . send ( ` Ready to serve in ${ this . client . channels . size } channels on ${ this . client . guilds . size } servers, for a total of ${ this . client . users . size } users. ${ this . client . readyAt } ` ) ;
channel . send ( ` Ready to serve in ${ this . client . channels . size } channels on ${ this . client . guilds . size } servers, for a total of ${ this . client . users . size } users. ${ this . client . readyAt } ` ) ;
}
}
/ *
//Fetch messages in every channel ( so they can still enter starboard in case of reboot)
let array = [ ] ;
let channels = this . client . channels . array ( ) ;
for ( const channel of channels . values ( ) ) {
array . push ( channel . id ) ;
}
for ( let i = 0 ; i < this . client . channels . size ; i ++ ) {
let channel = this . client . channels . get ( array [ i ] ) ;
if ( channel . messages ) {
channel . messages . fetch ( { limit : 10 } )
. then ( messages => console . log ( ` Received ${ messages . size } messages ` ) )
. catch ( err => console . error ( err ) ) ;
}
}
* /
}
}
}
}