nyx/events/ready.js

57 lines
1.8 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({
2021-09-06 12:38:25 +02:00
activities: [
2021-07-13 05:17:39 +02:00
{
name: "Under Maintenance",
2021-09-06 12:38:25 +02:00
type: "STREAMING",
url: "https://twtich.tv/thekiritosgaming",
2021-07-13 05:17:39 +02:00
},
],
2021-09-06 12:38:25 +02:00
status: "online",
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);
2021-09-06 12:38:25 +02:00
client.user.setPresence({
activities: [
{
name: playing[game],
type: "STREAMING",
url: "https://twitch.tv/thekiritosgaming",
},
],
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}`);
2021-09-06 12:38:25 +02:00
client.channels.cache.get(client.ReadyLog).send({ embeds: [embed] });
2021-06-12 12:53:51 +02:00
});