nyx/events/ready.js

63 lines
2 KiB
JavaScript
Raw Normal View History

2021-06-24 09:53:19 +02:00
const client = require("../bot");
2021-06-12 12:53:51 +02:00
const config = require("../config.json");
const prefix = config.prefix;
const version = require("../package.json").version;
const { MessageEmbed } = require("discord.js");
2021-07-13 05:17:39 +02:00
const m = require("../models/bot");
const test = require("../util/dist/cmds").cmds();
client.on("ready", async () => {
client.manager.init(client.user.id);
2021-06-12 12:53:51 +02:00
var users = client.guilds.cache
.reduce((a, b) => a + b.memberCount, 0)
.toLocaleString();
2021-07-13 05:17:39 +02:00
var guilds = client.guilds.cache.size.toString();
await client.data.botcache(client.user.id, guilds, users);
await client.data.commands(client.user.id, test);
var playing = [`v${version} | ${prefix}help`, client.web, `${users} users`];
2021-06-14 18:54:02 +02:00
async function find() {
const statusdb = await m.findOne({
Status: "true",
2021-06-12 12:53:51 +02:00
});
2021-06-14 18:54:02 +02:00
if (statusdb && statusdb.Status == "true") {
2021-07-13 05:17:39 +02:00
client.user.setPresence({
activity: [
{
name: "Under Maintenance",
type: "WATCHING",
},
],
status: "dnd",
2021-06-14 18:54:02 +02:00
});
2021-07-13 05:17:39 +02:00
// client.user.setPresence({
// activity: [
// {
// name: "Under Maintenance",
// type: "STREAMING",
// url: "https://twtich.tv/thekiritosgaming",
// },
// ],
// status: "dnd",
// });
2021-06-14 18:54:02 +02:00
} else {
2021-07-13 05:17:39 +02:00
setInterval(function () {
2021-06-14 18:54:02 +02:00
var game = Math.floor(Math.random() * playing.length + 0);
client.user.setActivity({
name: playing[game],
type: "STREAMING",
2021-07-13 05:17:39 +02:00
url: "https://twitch.tv/thekiritosgaming",
//status: "online",
2021-06-14 18:54:02 +02:00
});
}, 5000);
}
}
find();
2021-06-12 12:53:51 +02:00
console.log(`${client.user.username}\nVersion: v${version}`);
var embed = new MessageEmbed()
.setColor(client.color)
.setTitle(`${client.user.tag} is online`)
.setDescription(`${client.user.username}\nVersion: v${version}`)
.setTimestamp()
.setFooter(`${client.user.username}`);
client.ReadyLog.send(embed);
});