#where i can find a example for a bot

1 messages · Page 1 of 1 (latest)

tidal portal
#

const { Client, GatewayIntentBits } = require('discord.js'); const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, ], }); client.on('ready', () => { console.log(Logged in as ${client.user.tag}!`);
});

client.on("messageCreate", (message) => {
console.log(message.content);
if (message.content.startsWith("ping")) {
message.channel.send("pong!");
}
});

client.login("key");
`

weary wyvern
#

youre missing messageContent intent

tidal portal
#

it fail when i put it

weary wyvern
#

what do you mean fail

tidal portal
#

i give admin to the bot

weary wyvern
#

what do you mean fail

tidal portal
#

`node_modules/discord.js/src/client/websocket/WebSocketManager.js:250
throw new DiscordjsError(unrecoverableErrorCodeMap[error.code]);
^

Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
at WebSocketManager.createShards (/mnt/c/xampp/htdocs/RuedaFortuna/node_modules/discord.js/src/client/websocket/WebSocketManager.js:250:15)
at async Client.login (/mnt/c/xampp/htdocs/RuedaFortuna/node_modules/discord.js/src/client/Client.js:226:7) {
code: 'DisallowedIntents'
}

Node.js v20.0.0`

weary wyvern
#

enable it on your bots dashboard

dire galeBOT
#

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