I have coded a discord bot with the help of my friends, we tried making a music bot, but the plan failed horribly as we were entering the tokens. We have a separate file for tokens called “config.json” We have stuff like
Youtube API
Soundcloud API (got it from f12 screen)
and then the bot token.
Now to the problem, whenever I try to make the bot go online by doing “node .” in CMD, it just doesn’t give me a error or anything, just stays empty.
My index/main/botTEST.js
const Discord = require(‘discord.js’);
const client = new Discord.Client();
const prefix = ‘-’;
const fs = require(‘fs’);
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync(’./commands/’).filter(file => file.endsWith(’.js’));
for(const file of commandFiles){
const command = require(./commands/${file}
);
client.commands.set(command.name, command);
}
const { join } = require(“path”);
const { TOKEN, PREFIX } = require("./config.json");
client.once(‘ready’, () => {
console.log(‘qestnik is online!’);
});
client.on(‘message’, message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'pause'){
client.commands.get('pause').execute(message, args);
} else if (command == 'loop'){
client.commands.get('loop').execute(message, args);
} else if (command == 'play'){
client.commands.get('play').execute(message, args);
} else if (command == 'skip'){
client.commands.get('skip').execute(message, args);
}else if (command == 'queue'){
client.commands.get('queue').execute(message, args);
} else if (command == 'resume'){
client.commands.get('resume').execute(message, args);
} else if (command == 'playlist'){
client.commands.get('playlist').execute(message, args);
};
});