#Bot not responding to prefix or anything but is online

10 messages · Page 1 of 1 (latest)

near orbit
#

My code below is what I am using and my prefix is: ! using json "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);
    }
});```
livid sealBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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!
midnight kiln
#

show your client constructor

near orbit
#
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent] });
#

and its enabled on portal

midnight kiln
#

Missing GuildMessages intent

near orbit
#

Ahh ty, but now have this issue:

  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```
midnight kiln
#

because the channel isnt a textbasedchannel

#

and that is gonna get you ratelimited

#

and guild.channels.cache.get exists