#trying to set up a bot but it doesnt work

30 messages · Page 1 of 1 (latest)

true cave
#

i was setting up a bot and after attempting to bring the bot online it failed

prisma ospreyBOT
#
  • 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!
true cave
#
  • 14.12.1
#

code:

#
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMembers,
    ],
});

const Discord = require('discord.js');
const bot = new Discord.Client();
const token = '';
const PREFIX = '';

bot.on('ready', () => {
    console.log('i am online')


})
bot.login(token)
#

(of course without the token)

#
      throw new DiscordjsTypeError(ErrorCodes.ClientMissingIntents);
      ^

TypeError [ClientMissingIntents]: Valid intents must be provided for the Client.
    at Client._validateOptions (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\discord.js\src\client\Client.js:492:13)
    at new Client (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\discord.js\src\client\Client.js:78:10)
    at Object.<anonymous> (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\index.js:13:13)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'ClientMissingIntents'
}

Node.js v18.17.0
#

and heres the error message i got

fervent jay
#

you made 2 client instances
one is client, the other is bot. you only need one so just use client and remove bot

true cave
tacit hullBOT
#

Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.

If you are using the GuildMembers, GuildPresences, or MessageContent intents, you need to enable them in the developer portal:

true cave
#
Error: Used disallowed intents
    at WebSocketShard.onClose (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\@discordjs\ws\dist\index.js:1132:18)
    at connection.onclose (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\@discordjs\ws\dist\index.js:676:17)
    at callListener (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\ws\lib\event-target.js:290:14)
    at WebSocket.onClose (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\ws\lib\event-target.js:220:9)
    at WebSocket.emit (node:events:514:28)
    at WebSocket.emitClose (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\ws\lib\websocket.js:258:10)
    at TLSSocket.socketOnClose (C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\ws\lib\websocket.js:1264:15)
    at TLSSocket.emit (node:events:526:35)
    at node:net:323:12
    at TCP.done (node:_tls_wrap:588:7)
fervent jay
#

the dev portal

#
  • Developer Portal > Your app > Bot > Privileged Gateway Intents
true cave
fervent jay
#

Bot > Privileged Gateway Intents

#

please read this closely

true cave
#

alr found it sorry

true cave
#

thank you so much!

fervent jay
#

you're welcome blobreach

true cave
long cove
#

deploy the commands

tacit hullBOT
#

guide Creating Your Bot: Registering slash commands
read more

true cave
#

@long cove i dont have a config.json file

long cove
#

then use what you do have and dont ping me