-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (22 loc) · 1002 Bytes
/
index.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
const Discord = require('discord.js');
const token = require('./token.json');
const fs = require('fs');
const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MEMBERS', 'GUILD_VOICE_STATES'] });
module.exports.client = client;
let statsFile = fs.readFileSync('/var/services/homes/william/BountyBot/data/stats.json');
let stats = JSON.parse(statsFile);
module.exports.stats = stats;
const commandFiles = fs.readdirSync("/var/services/homes/william/BountyBot/commands");
const commands = [];
const eventFiles = fs.readdirSync("/var/services/homes/william/BountyBot/events");
for (const file of eventFiles) {
const event = require(`/var/services/homes/william/BountyBot/events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args, stats, commands));
}
else {
client.on(event.name, (...args) => event.execute(...args, stats, commands));
}
}
client.login(token.bot);
//client.login(process.env.BOT_TOKEN);