nyx/bot.js

106 lines
3.3 KiB
JavaScript
Raw Normal View History

2021-09-06 12:38:25 +02:00
const { Client, Collection, MessageEmbed, Intents } = require("discord.js");
2021-07-13 05:17:39 +02:00
const { GiveawaysManager } = require("discord-giveaways");
const config = require("./config.json");
const version = require("./package.json").version;
2021-07-13 05:17:39 +02:00
require("dotenv").config();
const client = new Client({
allowedMentions: { parse: ["users", "roles"], repliedUser: true },
presence: {
activities: [
{
name: `v${version} | ${config.prefix}help`,
type: "STREAMING",
url: "https://www.youtube.com/watch?v=_D5xG7XoF88",
},
],
},
2021-07-13 05:17:39 +02:00
restTimeOffset: 0,
partials: ["MESSAGE", "CHANNEL", "REACTION", "GUILD_MEMBER"],
2021-09-06 12:38:25 +02:00
intents: [
Intents.FLAGS.GUILDS,
//Intents.FLAGS.GUILD_MEMBERS,
2021-09-06 12:38:25 +02:00
Intents.FLAGS.GUILD_BANS,
Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
Intents.FLAGS.GUILD_INVITES,
Intents.FLAGS.GUILD_VOICE_STATES,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.DIRECT_MESSAGES,
//Intents.FLAGS.GUILD_PRESENCES,
2021-09-06 12:38:25 +02:00
],
2021-07-13 05:17:39 +02:00
});
module.exports = client;
require("./util/functions/economy")(client);
require("./util/dist/manager")(client);
2021-09-06 12:38:25 +02:00
require("./util/dist/handler")(client);
2021-07-13 05:17:39 +02:00
client.commands = new Collection();
2021-09-06 12:38:25 +02:00
client.slashCommands = new Collection();
2021-07-13 05:17:39 +02:00
client.aliases = new Collection();
client.esnipes = new Collection();
client.hide = new Collection();
2021-09-06 12:38:25 +02:00
client.snipes = new Array();
2021-07-13 05:17:39 +02:00
client.queue = new Map();
client.Timers = new Map();
client.config = config;
2021-07-13 05:17:39 +02:00
client.function = require("./util/functions/function");
client.data = require("./util/functions/mongoose");
client.err = require("./util/dist/err");
client.serr = require("./util/dist/slash");
2021-09-06 12:38:25 +02:00
client.cat = client.config.ca;
client.SuggestionLog = client.config.Suggestion;
client.ReportLog = client.config.Report;
client.DMLog = client.config.DMLog;
client.CMDLog = client.config.CMDLog;
client.ServerLog = client.config.ServerLog;
client.ErrorLog = client.config.ErrorLog;
client.color = client.config.color;
client.author = "Cath Team";
client.invite = "https://discord.gg/SbQHChmGcp";
client.web = client.config.URL;
2021-07-13 05:17:39 +02:00
client.data
.connect(process.env.MONGO)
.then(() => console.log("Connected to MongoDB!"))
.catch(e => console.log(e));
client.owners = [
2021-09-06 12:38:25 +02:00
"452076196419600394", //Night
"766645910087139338", //chekseaa
"755476040029306952", //Kałÿ
"534027706325532694", //Cat drinking a cat
"381442059111759883", //Thunder
"556808365574193194", //chunchunmaru
2021-07-13 05:17:39 +02:00
];
client.currency = "<:cp:840231933933387797>";
client.path = [
"614423108388126731",
"767173194943168542",
"783633408738721834",
"718762019586572341",
"784052348561522730",
"840225563193114624",
"800396461229080619",
];
client.giveaways = new GiveawaysManager(client, {
storage: "./util/Data/giveaways.json",
updateCountdownEvery: 1000,
default: {
botsCanWin: false,
embedColor: client.color,
reaction: "🎉",
},
});
2021-09-06 12:38:25 +02:00
process.on("unhandledRejection", async err => {
if (client.user) {
if (client.user.id === client.user.id) {
const embed = new MessageEmbed()
.setTitle("UnhandledRejection Error")
.setDescription(`\`\`\`ini\n${err.stack}\`\`\``)
.setTimestamp()
.setColor(client.color)
.setFooter(client.user.username);
client.channels.cache.get(client.ErrorLog).send({ embeds: [embed] });
}
}
return console.log(err);
2021-07-13 05:17:39 +02:00
});
client.login(process.env.TOKEN);