This repository has been archived by the owner on Oct 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfennec.js
67 lines (53 loc) · 2.13 KB
/
fennec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require('dotenv').config();
require('dotenv').load();
const Discord = require("discord.js");
const fs = require("fs");
const config = require("./assets/json/config.json")
const client = new Discord.Client();
const chalk = require('chalk');
// Listens for Errors and Warnings. Debug shows Discord Web Socket Information
client.on("error", (e) => console.log(e));
client.on("warn", (e) => console.log(e));
client.on("guildCreate", guild => { console.log(chalk.yellow.bold(`< FennecBot joined server: ${guild.name} [ID = ${guild.id}] This server has ${guild.memberCount} members. >`));});
client.on("guildDelete", guild => { console.log(chalk.yellow.bold(`< FennecBot was removed from: ${guild.name} [ID = ${guild.id}] >`));});
client.config = config;
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Discord.Collection();
client.commands.aliases = new Discord.Collection();
const modules = [
'fun',
'memes',
'misc',
'moderation',
'utility',
'developer',
'nsfw',
'economy',
'games',
'actions'
];
console.log(chalk.blue.bold(`------------------------------------------------------`));
modules.forEach(c => {
fs.readdir(`./commands/${c}/`, (err, files) => { if (err) throw err;
console.log(chalk.white(` > Loaded `) + chalk.blue.bold(files.length) + chalk.white(` commands from the `) + chalk.blue.bold(c) + chalk.white(` module`));
files.forEach(f => {
const command = require(`./commands/${c}/${f}`);
client.commands.set(command.name, command);
/*client.commands.aliases.forEach(aliases => {
client.aliases.set(aliases, command.name);
});*/
});
});
});
process.on('unhandledRejection', error => {
console.error(chalk.red('<< ERROR FOUND >> \n' + error.stack));
});
//login to FennecBot
client.login(process.env.BOT_TOKEN)