Bot not replying

Hi! My bot is not replying. Message intents are enabled, I used a tutorial from a year ago and haven't been able to find out where it all goes wrong </3 I'm new to discord.js main.js
const Discord = require('discord.js');

const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.commands = new Collection();

client.once('ready', () => {
console.log(`⚠️ | The client is now online.`);
});

const fs = require('fs');
const prefix = 's!';
const commandsPath = path.join(__dirname, 'commands');
client.commands = new Discord.Collection();
const commands = fs.readdirSync('./Commands').filter(file => file.endsWith('.js'));
for (file of commands) {
const filePath = path.join(commandsPath, file);
const commandName = file.split('.')[0];
const command = require(`./Commands/${commandName}`);
client.commands.set (commandName, command);
};

client.on('messageCreate', message => {
if (message.content.startsWith(prefix)) {
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const commandName = args.shift();
const command = client.commands.get(commandName);
if (!command) {
return message.reply(':question: | Sorry, that command doesn\'t exist!');
}
command.run (client, message, args);
}
});

client.login('CLIENT KEY IS HERE, IVE JUST REMOVED IT FOR OBVIOUS REASONS');
const Discord = require('discord.js');

const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.commands = new Collection();

client.once('ready', () => {
console.log(`⚠️ | The client is now online.`);
});

const fs = require('fs');
const prefix = 's!';
const commandsPath = path.join(__dirname, 'commands');
client.commands = new Discord.Collection();
const commands = fs.readdirSync('./Commands').filter(file => file.endsWith('.js'));
for (file of commands) {
const filePath = path.join(commandsPath, file);
const commandName = file.split('.')[0];
const command = require(`./Commands/${commandName}`);
client.commands.set (commandName, command);
};

client.on('messageCreate', message => {
if (message.content.startsWith(prefix)) {
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const commandName = args.shift();
const command = client.commands.get(commandName);
if (!command) {
return message.reply(':question: | Sorry, that command doesn\'t exist!');
}
command.run (client, message, args);
}
});

client.login('CLIENT KEY IS HERE, IVE JUST REMOVED IT FOR OBVIOUS REASONS');
Commands/ping.js
module.exports.run = (client, message, args) => {
message.reply('🏓 | Pong!');
};
module.exports.run = (client, message, args) => {
message.reply('🏓 | Pong!');
};
4 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
willowissnake (ssss)
The bot also has permissions in the server node v18.17.1 discord.js v14.13.0
treble/luna
treble/luna9mo ago
you miss the GuildMessages and MessageContent intent and the token isnt the client key either
willowissnake (ssss)
ah i see yeah thats just me badly wording it 😅 It works! Thanks so much!