question

GlowBunny-4489 avatar image
0 Votes"
GlowBunny-4489 asked romungi-MSFT edited

Discord Bot Not working

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-supported-azure
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

doesn't work means ?

0 Votes 0 ·

I mean that if i do "!ping"
it wont say "Pong."

0 Votes 0 ·

@GlowBunny-4489 It looks like you are referring to your discord bot setup which is an unsupported tag on MS Q&A forum. The code samples and repo of discord might be appropriate forum to post this so the appropriate community could respond. I would suggest to check the sample here for the functionality you have described.


0 Votes 0 ·

0 Answers