#trying to set up a bot but it doesnt work
30 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - 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!
- 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
you made 2 client instances
one is client, the other is bot. you only need one so just use client and remove bot
ok
oh, yea i see that
error: new Error("Used disallowed intents")
^
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:
- Developer Portal > Your app > Bot > Privileged Gateway Intents
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)
in oauth right?
alr found it sorry
you're welcome 
quick question, after I make a slash command, how would I update the bot so it allows people to use the command?
deploy the commands
ill look through that thanks
@long cove i dont have a config.json file
then use what you do have and dont ping me
Creating Your Bot: Registering slash commands