2021-12-10 21:39:54 +05:00
const chalk = require ( "chalk" ) ;
module . exports = class {
2021-12-26 19:29:37 +05:00
constructor ( client ) {
2021-12-10 21:39:54 +05:00
this . client = client ;
}
2021-12-26 19:29:37 +05:00
async run ( ) {
2021-12-10 21:39:54 +05:00
const client = this . client ;
2021-12-16 23:42:58 +05:00
// Logs some informations using logger
2021-12-10 21:39:54 +05:00
client . logger . log ( ` Loading a total of ${ client . commands . size } command(s). ` , "log" ) ;
client . logger . log ( ` ${ client . user . tag } , ready to serve ${ client . users . cache . size } users in ${ client . guilds . cache . filter ( guild => guild . id != "568120814776614924" && guild . id != "892727526911258654" ) . size } servers. ` , "ready" ) ;
2021-12-26 19:29:37 +05:00
client . logger . log ( ` Invite Link: https://discordapp.com/oauth2/authorize?client_id= ${ this . client . user . id } &scope=bot&permissions=8 ` ) ;
2021-12-10 21:39:54 +05:00
2021-12-16 23:42:58 +05:00
// Discord Together
2021-12-12 14:47:06 +05:00
const discordtogether = require ( "../helpers/discordTogether" ) ;
discordtogether . init ( client ) ;
2021-12-16 23:42:58 +05:00
// DiscordBots.org STATS
2021-12-12 14:47:06 +05:00
const discordbotsorg = require ( "../helpers/discordbots.org" ) ;
2021-12-10 21:39:54 +05:00
discordbotsorg . init ( client ) ;
2021-12-16 23:42:58 +05:00
// UNMUTE USERS
2021-12-12 14:47:06 +05:00
const checkUnmutes = require ( "../helpers/checkUnmutes" ) ;
2021-12-10 21:39:54 +05:00
checkUnmutes . init ( client ) ;
2021-12-16 23:42:58 +05:00
// SEND REMINDS
2021-12-12 14:47:06 +05:00
const checkReminds = require ( "../helpers/checkReminds" ) ;
2021-12-10 21:39:54 +05:00
checkReminds . init ( client ) ;
2021-12-16 23:42:58 +05:00
// DAILY SHOP FORTNITE
2021-12-12 14:47:06 +05:00
const fortniteShop = require ( "../helpers/fortniteShop" ) ;
2021-12-10 21:39:54 +05:00
fortniteShop . init ( client ) ;
// Start the dashboard
if ( client . config . dashboard . enabled ) client . dashboard . load ( client ) ;
2021-12-16 23:42:58 +05:00
// Update status every 20s
2021-12-18 18:53:11 +05:00
let servers = client . guilds . cache . filter ( guild => guild . id != "568120814776614924" && guild . id != "892727526911258654" ) . size ;
2021-12-26 19:29:37 +05:00
const version = require ( "../package.json" ) . version ;
2021-12-10 21:39:54 +05:00
const status = [
2021-12-18 19:15:16 +05:00
{ name : ` ${ servers } ${ getNoun ( servers , "сервер" , "сервера" , "серверов" ) } ` , type : "WATCHING" } ,
2021-12-16 16:40:45 +05:00
{ name : "help" , type : "WATCHING" }
2021-12-10 21:39:54 +05:00
] ;
2021-12-26 19:29:37 +05:00
2021-12-10 21:39:54 +05:00
let i = 0 ;
2021-12-26 19:29:37 +05:00
setInterval ( function ( ) {
2021-12-18 18:53:11 +05:00
servers = client . guilds . cache . filter ( guild => guild . id != "568120814776614924" && guild . id != "892727526911258654" ) . size ;
2021-12-16 23:42:58 +05:00
const random = status [ parseInt ( i , 10 ) ] ;
2021-12-26 19:29:37 +05:00
client . user . setActivity ( ` ${ random . name } | v ${ version } ` , {
type : random . type
} ) ;
2021-12-18 18:53:11 +05:00
2021-12-10 21:39:54 +05:00
if ( status [ parseInt ( i + 1 , 10 ) ] ) i ++ ;
else i = 0 ;
} , 20000 ) ; // Every 20 seconds
}
2021-12-18 18:53:11 +05:00
} ;
function getNoun ( number , one , two , five ) {
let n = Math . abs ( number ) ;
n %= 100 ;
if ( n >= 5 && n <= 20 ) return five ;
n %= 10 ;
if ( n === 1 ) return one ;
if ( n >= 2 && n <= 4 ) return two ;
return five ;
2021-12-10 21:39:54 +05:00
} ;