2022-07-23 17:14:42 +05:00
|
|
|
const BaseEvent = require("../base/BaseEvent"),
|
2022-07-31 17:08:00 +05:00
|
|
|
{ PermissionsBitField } = require("discord.js");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2022-07-23 17:14:42 +05:00
|
|
|
class Ready extends BaseEvent {
|
|
|
|
constructor() {
|
|
|
|
super({
|
|
|
|
name: "ready",
|
|
|
|
once: false
|
|
|
|
});
|
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()];
|
2022-01-24 02:06:30 +05:00
|
|
|
let hiddenGuild = await client.guilds.fetch("568120814776614924");
|
|
|
|
let tUsers = client.users.cache.size - hiddenGuild.memberCount;
|
|
|
|
let tServers = client.guilds.cache.size - 1;
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
// Logs some informations using logger
|
2022-07-26 17:20:10 +05:00
|
|
|
client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready");
|
2022-01-24 01:51:04 +05:00
|
|
|
client.logger.log(`${client.user.tag}, ready to serve ${tUsers} users in ${tServers} servers.`, "ready");
|
2022-07-31 17:08:00 +05:00
|
|
|
client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"] , permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
// Birthday Announce
|
|
|
|
const birthdays = require("../helpers/birthdays");
|
|
|
|
birthdays.init(client);
|
|
|
|
|
2022-01-24 02:06:30 +05:00
|
|
|
// Unmute users
|
2022-01-04 02:18:28 +05:00
|
|
|
const checkUnmutes = require("../helpers/checkUnmutes");
|
|
|
|
checkUnmutes.init(client);
|
|
|
|
|
2022-01-24 02:06:30 +05:00
|
|
|
// Send reminds
|
2022-01-04 02:18:28 +05:00
|
|
|
const checkReminds = require("../helpers/checkReminds");
|
|
|
|
checkReminds.init(client);
|
|
|
|
|
2022-07-02 01:17:00 +05:00
|
|
|
// Clear transactions
|
|
|
|
const clearTransactions = require("../helpers/clearTransactions");
|
|
|
|
clearTransactions.init(client);
|
|
|
|
|
2022-01-04 02:18:28 +05:00
|
|
|
// Start the dashboard
|
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
|
|
|
|
2022-01-24 02:06:30 +05:00
|
|
|
// Update status
|
2022-01-04 02:18:28 +05:00
|
|
|
const version = require("../package.json").version;
|
|
|
|
const status = [
|
2022-01-26 19:07:19 +05:00
|
|
|
{ name: "help", type: "LISTENING" },
|
2022-07-23 17:14:42 +05:00
|
|
|
{ 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: "LISTENING"},
|
2022-01-26 19:07:19 +05:00
|
|
|
{ name: `${tServers} ${client.getNoun(tServers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}`, type: "WATCHING" },
|
|
|
|
{ name: `${tUsers} ${client.getNoun(tUsers, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}`, type: "WATCHING" }
|
2022-01-04 02:18:28 +05:00
|
|
|
];
|
|
|
|
|
|
|
|
let i = 0;
|
2022-01-24 02:06:30 +05:00
|
|
|
setInterval(async function () {
|
|
|
|
hiddenGuild = await client.guilds.fetch("568120814776614924");
|
|
|
|
tUsers = client.users.cache.size - hiddenGuild.memberCount;
|
2022-01-24 19:40:47 +05:00
|
|
|
tServers = client.guilds.cache.size - 1;
|
2022-01-05 12:00:37 +05:00
|
|
|
const toShow = status[parseInt(i, 10)];
|
2022-01-04 02:18:28 +05:00
|
|
|
|
2022-01-05 12:00:37 +05:00
|
|
|
client.user.setActivity(`${toShow.name} | v${version}`, {
|
|
|
|
type: toShow.type
|
2022-01-04 02:18:28 +05:00
|
|
|
});
|
|
|
|
|
|
|
|
if (status[parseInt(i + 1, 10)]) i++;
|
|
|
|
else i = 0;
|
2022-07-23 17:14:42 +05:00
|
|
|
}, 10 * 1000); // Every 10 seconds
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-07-23 17:14:42 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Ready;
|