-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
53 lines (44 loc) · 1.67 KB
/
bot.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
const express = require('express')
const app = express();
const port = 3000
app.get('/', (req, res) => res.send('Dah On Tod'))
app.listen(port, () =>
console.log(`Your app is listening a http://localhost:${port}`)
);
const { Client, Collection } = require("discord.js");
const Discord = require('discord.js');
const emoji = require('./botconfig/emoji.json')
const client = new Client();
require('discord-buttons')(client);
const chalk = require("chalk");
const fs = require("fs");
client.commands = new Collection();
fs.readdir(__dirname + "/botcmd/events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let event = require(__dirname + "/botcmd/events/" + file);
let eventName = file.split(".")[0];
console.log(
chalk.blue.bold("Loading event ") + chalk.magenta.bold(`"${eventName}"`)
);
client.on(eventName, event.bind(null, client));
});
});
fs.readdir(__dirname + "/botcmd/commands/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(__dirname + "/botcmd/commands/" + file);
let commandName = file.split(".")[0];
console.log(
chalk.blue.bold("Loading command ") + chalk.red.bold(`"${commandName}"`)
);
client.commands.set(commandName, props);
});
});
client.login(require("./config/bot").token).catch(err => console.log(chalk.red.bold(err)))
/*********************************************************
@INFO
https://github.com/VynzzDev
*********************************************************/