Discord Bot Not working

Glow Bunny 1 Reputation point
2020-12-09T07:14:55.7+00:00

help, ive done this but it doesnt work:

const fs = require('fs');
const Discord = require('discord.js');
const { prefix, token } = require('./config.json');

const client = new Discord.Client();
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);
}

client.once('ready', () => {
console.log('Online');
});

client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).trim().split('/ +/');
const command = args.shift().toLowerCase();

if (!client.commands.has(command)) return;

try {
client.commands.get(command).execute(message, args);
} catch (error) {
console.error(error);
message.reply('there was an error trying to execute that command!');
}
});

client.login(token);

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,625 questions
{count} votes