forked from chebro/discord-voice-recorder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (26 loc) · 1.09 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
const Discord = require('discord.js');
const client = new Discord.Client(
{intents: ["GUILD_MESSAGES", "GUILD_VOICE_STATES", "GUILDS"]}
);
const config = require('./config.json');
const commands = require(`./bin/commands`);
//in case the bot was not configured properly
if(!config.PREFIX || !config.BOT_TOKEN) {
console.error("Error: The configuration file was configured improperly. Please ensure there are no spelling mistakes.");
process.exit(1);
}
console.log(config.PREFIX)
client.on('message', msg => {
if (msg.content.startsWith(config.PREFIX)) {
console.log("test")
const commandBody = msg.content.substring(config.PREFIX.length).split(' ');
const channelName = commandBody[1];
if (msg.content === ",enter") commands.enter(msg, channelName) && console.log("joining vc..")
if (commandBody[0] === ('enter') && commandBody[1]) commands.enter(msg, channelName) && console.log("joining vc..")
if (commandBody[0] === ('exit')) commands.exit(msg);
}
});
client.login(config.BOT_TOKEN);
client.on('ready', () => {
console.log(`\nONLINE\n`);
});