2022-08-04 21:02:45 +05:00
|
|
|
const { PermissionsBitField, ActivityType } = require("discord.js");
|
|
|
|
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
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async execute(client) {
|
|
|
|
const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()];
|
2023-03-30 15:52:58 +05:00
|
|
|
|
|
|
|
let hiddenGuildMembersCount = client.guilds.cache.get("568120814776614924").memberCount;
|
2022-01-24 02:06:30 +05:00
|
|
|
let tServers = client.guilds.cache.size - 1;
|
2023-03-30 15:52:58 +05:00
|
|
|
let tUsers = 0;
|
|
|
|
client.guilds.cache.forEach(g => {
|
|
|
|
tUsers += g.memberCount;
|
|
|
|
});
|
|
|
|
tUsers = tUsers - hiddenGuildMembersCount;
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2022-07-26 17:20:10 +05:00
|
|
|
client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready");
|
2023-03-30 15:52:58 +05:00
|
|
|
client.logger.log(`${client.user.tag}, ready to serve ${tUsers} members in ${tServers} servers.`, "ready");
|
2022-12-15 21:02:38 +05:00
|
|
|
client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready");
|
2023-03-30 15:52:58 +05:00
|
|
|
console.timeEnd("botReady");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
const birthdays = require("../helpers/birthdays");
|
|
|
|
birthdays.init(client);
|
|
|
|
|
|
|
|
const checkUnmutes = require("../helpers/checkUnmutes");
|
|
|
|
checkUnmutes.init(client);
|
|
|
|
|
|
|
|
const checkReminds = require("../helpers/checkReminds");
|
|
|
|
checkReminds.init(client);
|
|
|
|
|
2022-08-30 14:26:56 +05:00
|
|
|
const cleanup = require("../helpers/cleanup");
|
|
|
|
cleanup.init(client);
|
2022-07-02 01:17:00 +05:00
|
|
|
|
2022-07-26 17:20:10 +05:00
|
|
|
if (client.config.dashboard.enabled) client.dashboard.init(client);
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
const version = require("../package.json").version;
|
|
|
|
const status = [
|
2022-08-04 21:02:45 +05:00
|
|
|
{ name: "help", type: ActivityType.Watching },
|
|
|
|
{ name: `${commands.length} ${client.getNoun(commands.length, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))}`, type: ActivityType.Listening },
|
|
|
|
{ name: `${tServers} ${client.getNoun(tServers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}`, type: ActivityType.Watching },
|
2022-12-15 21:02:38 +05:00
|
|
|
{ name: `${tUsers} ${client.getNoun(tUsers, 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 () {
|
2023-03-30 15:52:58 +05:00
|
|
|
hiddenGuildMembersCount = client.guilds.cache.get("568120814776614924").memberCount;
|
2022-01-24 19:40:47 +05:00
|
|
|
tServers = client.guilds.cache.size - 1;
|
2023-03-30 15:52:58 +05:00
|
|
|
tUsers = 0;
|
|
|
|
client.guilds.cache.forEach(g => {
|
|
|
|
tUsers += g.memberCount;
|
|
|
|
});
|
|
|
|
tUsers = tUsers - hiddenGuildMembersCount;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Ready;
|