trying to set up a bot but it doesnt work

i was setting up a bot and after attempting to bring the bot online it failed
17 Replies
d.js toolkit
d.js toolkitβ€’16mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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!
Aquafy
AquafyOPβ€’16mo ago
- 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)
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)
C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\discord.js\src\client\Client.js:492
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
C:\Users\marcr\OneDrive\Desktop\New Giveaway bot\node_modules\discord.js\src\client\Client.js:492
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
Unknown User
Unknown Userβ€’16mo ago
Message Not Public
Sign In & Join Server To View
Aquafy
AquafyOPβ€’16mo ago
ok oh, yea i see that error: new Error("Used disallowed intents") ^
d.js docs
d.js docsβ€’16mo ago
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
Aquafy
AquafyOPβ€’16mo ago
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)
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?
Unknown User
Unknown Userβ€’16mo ago
Message Not Public
Sign In & Join Server To View
Aquafy
AquafyOPβ€’16mo ago
Unknown User
Unknown Userβ€’16mo ago
Message Not Public
Sign In & Join Server To View
Aquafy
AquafyOPβ€’16mo ago
alr found it sorry yay its online now πŸ˜„ thank you so much!
Unknown User
Unknown Userβ€’16mo ago
Message Not Public
Sign In & Join Server To View
Aquafy
AquafyOPβ€’16mo ago
quick question, after I make a slash command, how would I update the bot so it allows people to use the command?
treble/luna
treble/lunaβ€’16mo ago
deploy the commands
d.js docs
d.js docsβ€’16mo ago
guide Creating Your Bot: Registering slash commands read more
Aquafy
AquafyOPβ€’16mo ago
ill look through that thanks @luna🌈 i dont have a config.json file
treble/luna
treble/lunaβ€’16mo ago
then use what you do have and dont ping me
Aquafy
AquafyOPβ€’16mo ago
how nice alr
Want results from more Discord servers?
Add your server