Bot not responding to prefix or anything but is online

My code below is what I am using and my prefix is: ! using
"dependencies": {
"discord.js": "^14.11.0"
}
"dependencies": {
"discord.js": "^14.11.0"
}
client.on('messageCreate', (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 (command === 'help') {
showHelp(message);
} else if (command === 'monitor') {
monitorFolder(message, args);
} else if (command === 'stopmonitor') {
stopMonitoringFolder(message, args);
} else if (command === 'setinterval') {
setIntervalForFolder(message, args);
}
});
client.on('messageCreate', (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 (command === 'help') {
showHelp(message);
} else if (command === 'monitor') {
monitorFolder(message, args);
} else if (command === 'stopmonitor') {
stopMonitoringFolder(message, args);
} else if (command === 'setinterval') {
setIntervalForFolder(message, args);
}
});
6 Replies
d.js toolkit
d.js toolkit11mo 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!
treble/luna
treble/luna11mo ago
show your client constructor
2Much4U
2Much4U11mo ago
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent] });
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent] });
and its enabled on portal
treble/luna
treble/luna11mo ago
Missing GuildMessages intent
2Much4U
2Much4U11mo ago
Ahh ty, but now have this issue:
client.channels.cache.forEach((channel) => {
console.log(channel)
if (channel.guild.id === guildId) {
channel.send(messageOptions);
}
});
client.channels.cache.forEach((channel) => {
console.log(channel)
if (channel.guild.id === guildId) {
channel.send(messageOptions);
}
});
channel.send(messageOptions);
^

TypeError: channel.send is not a function
channel.send(messageOptions);
^

TypeError: channel.send is not a function
treble/luna
treble/luna11mo ago
because the channel isnt a textbasedchannel and that is gonna get you ratelimited and guild.channels.cache.get exists