Discord Bot Error - CLIENT_MISSING_INTENTS

Hello! I am making a discord bot with JavaScript on Replit but I keep getting this error?

 node index.js
/home/runner/sunset-lodge-bot/node_modules/discord.js/src/client/Client.js:548
      throw new TypeError('CLIENT_MISSING_INTENTS');
      ^

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
    at Client._validateOptions (/home/runner/sunset-lodge-bot/node_modules/discord.js/src/client/Client.js:548:13)
    at new Client (/home/runner/sunset-lodge-bot/node_modules/discord.js/src/client/Client.js:76:10)
    at Object.<anonymous> (/home/runner/sunset-lodge-bot/index.js:5:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  [Symbol(code)]: 'CLIENT_MISSING_INTENTS'
}
exit status 1
 

Don’t, people will be able to take and see your code, if it has a cookie they can log in!

I put it in the Secrets (Environment variables).

I think people could see it though?

Aha, found the problem.

The bot has no intents on.

Go to the Discord developer portal, go to your app then Bot, turn ALL intents on and you’re done!

Please make this as solution if it worked!

If you need help, reply or DM me :smile:

Here is everything that I enabled.

Yes, now run the bot and see if it works!

I still have the error.

 node index.js
/home/runner/sunset-lodge-bot/node_modules/discord.js/src/client/Client.js:548
      throw new TypeError('CLIENT_MISSING_INTENTS');
      ^

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
    at Client._validateOptions (/home/runner/sunset-lodge-bot/node_modules/discord.js/src/client/Client.js:548:13)
    at new Client (/home/runner/sunset-lodge-bot/node_modules/discord.js/src/client/Client.js:76:10)
    at Object.<anonymous> (/home/runner/sunset-lodge-bot/index.js:5:16)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  [Symbol(code)]: 'CLIENT_MISSING_INTENTS'
}
exit status 1


I don’t know a lot about JS, but it could be that your using the environment variables and either the script or Discord’s servers can’t see it. In a closed environment (not replit, remember, it’s publically viewable!), set the variables so it has the value, no secrets or stuff. Just the tokens and stuff.

In addition to that your bot is not supposed to be running on replit, replit is for building the code, not for hosting it, also remember that anybody can see your replits unless you pay to hide them.

1 Like

This topic was automatically closed after 7 days. New replies are no longer allowed.