2020-12-15 01:44:28 +00:00
import Event from "../core/event" ;
import { client } from "../index" ;
import $ from "../core/lib" ;
2021-04-06 03:57:03 +00:00
import { Config , Storage } from "../core/structures" ;
2020-12-31 16:10:56 +00:00
import { updateGlobalEmoteRegistry } from "../core/lib" ;
2020-07-25 11:01:24 +00:00
2020-12-15 01:44:28 +00:00
export default new Event < "ready" > ( {
once() {
if ( client . user ) {
2021-04-01 13:41:49 +00:00
$ . ready (
` Logged in as ${ client . user . tag } , ready to serve ${ client . users . cache . size } users in ${ client . guilds . cache . size } servers.. `
) ;
2020-12-15 01:44:28 +00:00
client . user . setActivity ( {
type : "LISTENING" ,
name : ` ${ Config . prefix } help `
} ) ;
}
2020-12-31 16:10:56 +00:00
updateGlobalEmoteRegistry ( ) ;
2021-04-06 03:57:03 +00:00
// Run this setup block once to restore eco bet money in case the bot went down. (And I guess search the client for those users to let them know too.)
for ( const id in Storage . users ) {
const user = Storage . users [ id ] ;
2021-04-06 06:02:52 +00:00
if ( user . ecoBetInsurance > 0 ) {
client . users . cache . get ( id ) ? . send ( ` Because my system either crashed or restarted while you had a pending bet, the total amount of money that you bet, which was \` ${ user . ecoBetInsurance } \` , has been restored. ` ) ;
user . money += user . ecoBetInsurance ;
user . ecoBetInsurance = 0 ;
2021-04-06 03:57:03 +00:00
}
}
Storage . save ( ) ;
2020-10-15 09:23:24 +00:00
}
} ) ;