forked from SerekKiri/CoinBot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
44 lines (37 loc) · 1.25 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const Discord = require('discord.js');
const debug = require('debug')('index');
const config = require('./src/config.json');
const crypto = require('./src/commands/crypto');
const coins = require('./src/commands/coins');
const help = require('./src/commands/help');
const donate = require('./src/commands/donate');
const github = require('./src/commands/github');
// const token = require('./src/token.json');
const client = new Discord.Client();
client.login(process.env.BOT_TOKEN);
// client.login(token.token);
client.on('ready', () => {
debug(`Coin bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
client.user.setPresence({ game: { name: client.users.size + ' miners', type: 3 } });
});
client.on('message', async (message) => {
if (message.content.substring(0, config.prefix.length) === config.prefix) {
const command = message.content.slice(config.prefix.length);
switch (command) {
case 'coins':
coins(message);
break;
case 'help':
help(message);
break;
case 'donate':
donate(message);
break;
case 'github':
github(message);
break;
default:
crypto(message, command);
}
}
});