Used disallowed intents

Question: i need help bad because i know this code works cus i had it on another bot but now it just doesn’t work any more here are my errors well some ain’t errors but here is what it shows

/nix/store/0g3sc6fhnhsxx8d837kyj06qcbjind1b-nodejs-18.16.1/bin/node $file
Project is running!
/home/runner/mrcolor-bot/node_modules/@discordjs/ws/dist/index.js:1132
          error: new Error("Used disallowed intents")
                 ^

Error: Used disallowed intents
    at WebSocketShard.onClose (/home/runner/mrcolor-bot/node_modules/@discordjs/ws/dist/index.js:1132:18)
    at connection.onclose (/home/runner/mrcolor-bot/node_modules/@discordjs/ws/dist/index.js:676:17)
    at callListener (/home/runner/mrcolor-bot/node_modules/ws/lib/event-target.js:290:14)
    at WebSocket.onClose (/home/runner/mrcolor-bot/node_modules/ws/lib/event-target.js:220:9)
    at WebSocket.emit (node:events:513:28)
    at WebSocket.emitClose (/home/runner/mrcolor-bot/node_modules/ws/lib/websocket.js:260:10)
    at TLSSocket.socketOnClose (/home/runner/mrcolor-bot/node_modules/ws/lib/websocket.js:1272:15)
    at TLSSocket.emit (node:events:525:35)
    at node:net:322:12
    at TCP.done (node:_tls_wrap:588:7)

Node.js v18.16.1
exit status 1

Repl link: https://replit.com/@COOLDOGSTEAM/mrcolor-bot

code snippet

It sounds like either:

  1. Your bot is using intents which were previously allowed, and now are not.
  2. You did not grant the bot these intents in the Discord Developer portal.
  3. You meant to specify one intent, and supplied a different one by mistake which isn’t allowed.

Of course, I could be missing something here, but these seem like the most likely causes.

2 Likes

i can show you all my codes cus i don’t know much

const express = require("express");
const app = express();

app.listen(3000, () => {
  console.log("Project is running!");
});

app.get("/", (req, res) => {
  res.send("Hello world");
})

const Discord =require("discord.js")
const client = new Discord.Client({intents: ['Guilds' , 'GuildMessages' , 'MessageContent']});

client.on("messageCreate", message => {
 if(message.content === "ping") {
  message.channel.send("pong")
} else if(message.content === "you suck") {
message.channel.send("why are you bullying me")
} else if(message.content === "PING") {
  message.channel.send("PONG")
} else if(message.content === "PRIME IS GOOD") {
message.channel.send("IM WITH YOU ON THAT")
}
});

const cron = require('node-cron')
cron.schedule('0 12 * * *', async () => {
const channel = await client.channels.fetch('1148058536325165121');
channel.send('Good afternoon');
}); 

client.login(process.env.token);
{
  "name": "my-bot",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "dependencies": {
    "accepts": "^1.3.8",
    "array-flatten": "^1.1.1",
    "body-parser": "^1.20.1",
    "busboy": "^1.6.0",
    "bytes": "^3.1.2",
    "call-bind": "^1.0.2",
    "content-disposition": "^0.5.4",
    "content-type": "^1.0.5",
    "cookie": "^0.5.0",
    "cookie-signature": "^1.0.6",
    "data-uri-to-buffer": "^4.0.0",
    "debug": "^2.6.9",
    "depd": "^2.0.0",
    "destroy": "^1.2.0",
    "discord-api-types": "^0.37.47",
    "discord.js": "^14.11.0",
    "ee-first": "^1.1.1",
    "encodeurl": "^1.0.2",
    "escape-html": "^1.0.3",
    "etag": "^1.8.1",
    "express": "^4.18.2",
    "fast-deep-equal": "^3.1.3",
    "fetch-blob": "^3.1.5",
    "file-type": "^18.5.0",
    "finalhandler": "^1.2.0",
    "formdata-polyfill": "^4.0.10",
    "forwarded": "^0.2.0",
    "fresh": "^0.5.2",
    "function-bind": "^1.1.1",
    "get-intrinsic": "^1.2.1",
    "has": "^1.0.3",
    "has-proto": "^1.0.1",
    "has-symbols": "^1.0.3",
    "http-errors": "^2.0.0",
    "iconv-lite": "^0.4.24",
    "ieee754": "^1.2.1",
    "inherits": "^2.0.4",
    "ipaddr.js": "^1.9.1",
    "lodash": "^4.17.21",
    "lodash.snakecase": "^4.1.1",
    "media-typer": "^0.3.0",
    "merge-descriptors": "^1.0.1",
    "methods": "^1.1.2",
    "mime": "^1.6.0",
    "mime-db": "^1.52.0",
    "mime-types": "^2.1.35",
    "ms": "^2.0.0",
    "negotiator": "^0.6.3",
    "node-bin-setup": "^1.1.3",
    "node-cron": "^3.0.2",
    "node-domexception": "^1.0.0",
    "node-fetch": "^3.3.0",
    "object-inspect": "^1.12.3",
    "on-finished": "^2.4.1",
    "parseurl": "^1.3.3",
    "path-to-regexp": "^0.1.7",
    "peek-readable": "^5.0.0",
    "proxy-addr": "^2.0.7",
    "qs": "^6.11.0",
    "range-parser": "^1.2.1",
    "raw-body": "^2.5.1",
    "readable-stream": "^3.6.2",
    "readable-web-to-node-stream": "^3.0.2",
    "safe-buffer": "^5.2.1",
    "safer-buffer": "^2.1.2",
    "send": "^0.18.0",
    "serve-static": "^1.15.0",
    "setprototypeof": "^1.2.0",
    "side-channel": "^1.0.4",
    "statuses": "^2.0.1",
    "streamsearch": "^1.1.0",
    "string_decoder": "^1.3.0",
    "strtok3": "^7.0.0",
    "toidentifier": "^1.0.1",
    "token-types": "^5.0.1",
    "ts-mixer": "^6.0.3",
    "tslib": "^2.6.0",
    "type-is": "^1.6.18",
    "undici": "^5.22.1",
    "unpipe": "^1.0.0",
    "util-deprecate": "^1.0.2",
    "utils-merge": "^1.0.1",
    "vary": "^1.1.2",
    "web-streams-polyfill": "^3.2.1",
    "ws": "^8.13.0"
  },
  "devDependencies": {
    "node": "^16.20.1"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

Could you verify that your bot has been granted all of these intents on the Discord Developer Portal?

what do you mean again by granted?

As in that your bot has access to these intents on the Developer Portal.

like my token and if i put it in a server?

No, as in the intents in the Developer Portal. I know certain intents are implied for smaller bots, but larger ones are required to explicitly enable some. So your bot might be missing those intents.






1 Like

You will need to enable the “message content” intent at minimum.

1 Like

oh thx i haven’t made a bot in a while so i forgot to do that

If that resolved your issue, please mark my post as a solution so that this topic can close.

i did thx:) bye bye and 1 more thx before i go:)

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