2024-02-06 21:45:53 +05:00
|
|
|
const { ActivityType } = require("discord.js");
|
2022-08-04 21:02:45 +05:00
|
|
|
const BaseEvent = require("../base/BaseEvent");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2022-07-23 17:14:42 +05:00
|
|
|
class Ready extends BaseEvent {
|
|
|
|
constructor() {
|
|
|
|
super({
|
|
|
|
name: "ready",
|
2022-12-15 21:02:38 +05:00
|
|
|
once: false,
|
2022-07-23 17:14:42 +05:00
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-07-23 17:14:42 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../base/Client")} client
|
2022-07-23 17:14:42 +05:00
|
|
|
*/
|
|
|
|
async execute(client) {
|
|
|
|
const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()];
|
2023-03-30 15:52:58 +05:00
|
|
|
|
2024-08-10 21:52:23 +05:00
|
|
|
let servers = client.guilds.cache.size;
|
|
|
|
let users = 0;
|
2023-03-30 15:52:58 +05:00
|
|
|
client.guilds.cache.forEach(g => {
|
2024-08-10 21:52:23 +05:00
|
|
|
users += g.memberCount;
|
2023-03-30 15:52:58 +05:00
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
const birthdays = require("../helpers/birthdays");
|
|
|
|
birthdays.init(client);
|
|
|
|
|
|
|
|
const checkReminds = require("../helpers/checkReminds");
|
|
|
|
checkReminds.init(client);
|
|
|
|
|
2023-06-27 19:01:39 +05:00
|
|
|
if (client.config.dashboard.enabled) await client.dashboard.load(client);
|
|
|
|
|
2024-02-06 21:45:53 +05:00
|
|
|
client.logger.ready(`Loaded a total of ${commands.length} command(s).`);
|
2024-08-10 21:52:23 +05:00
|
|
|
client.logger.ready(`${client.user.getUsername()}, ready to serve ${users} members in ${servers} servers.`);
|
2023-06-27 19:01:39 +05:00
|
|
|
|
|
|
|
console.timeEnd("botReady");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
const version = require("../package.json").version;
|
|
|
|
const status = [
|
2023-06-27 19:01:39 +05:00
|
|
|
{ name: "/help", type: ActivityType.Watching },
|
2023-04-20 11:47:47 +05:00
|
|
|
{ name: `${commands.length} ${client.functions.getNoun(commands.length, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))}`, type: ActivityType.Listening },
|
2024-08-10 21:52:23 +05:00
|
|
|
{ name: `${servers} ${client.functions.getNoun(servers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}`, type: ActivityType.Watching },
|
|
|
|
{ name: `${users} ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}`, type: ActivityType.Watching },
|
2022-01-04 02:18:28 +05:00
|
|
|
];
|
|
|
|
|
|
|
|
let i = 0;
|
2022-01-24 02:06:30 +05:00
|
|
|
setInterval(async function () {
|
2024-08-10 21:52:23 +05:00
|
|
|
servers = client.guilds.cache.size;
|
|
|
|
users = 0;
|
2023-03-30 15:52:58 +05:00
|
|
|
client.guilds.cache.forEach(g => {
|
2024-08-10 21:52:23 +05:00
|
|
|
users += g.memberCount;
|
2023-03-30 15:52:58 +05:00
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2023-03-30 15:52:58 +05:00
|
|
|
client.user.setActivity(`${status[i].name} | v${version}`, {
|
|
|
|
type: status[i].type,
|
2022-01-04 02:18:28 +05:00
|
|
|
});
|
|
|
|
|
2022-08-04 21:02:45 +05:00
|
|
|
if (status[i + 1]) i++;
|
2022-01-04 02:18:28 +05:00
|
|
|
else i = 0;
|
2023-03-30 15:52:58 +05:00
|
|
|
}, 30 * 1000); // Every 30 seconds
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-07-23 17:14:42 +05:00
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = Ready;
|