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 toolkit2y 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/luna2y ago
show your client constructor
Deleted & Will Never Return
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/luna2y ago
Missing GuildMessages intent
Deleted & Will Never Return
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/luna2y ago
because the channel isnt a textbasedchannel and that is gonna get you ratelimited and guild.channels.cache.get exists
Want results from more Discord servers?
Add your server