The thing is like this, I try to upgrade my original robot to V13 , So I decided to rewrite the bot.
I don’t know how to get all Intents at once I tried Intents.all but it didn't work this is my code
const { Client, Intents, MessageEmbed } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
const cofing = require("./cofig.json");
client.on('ready', () => {
console.log("================");
console.log("|i am ready|");
console.log("================");
});
client.on('message', async message => {
if(message.content === 'test'){
console.log("test")
}
});
client.login(cofing.token);
The thing is like this, I try to upgrade my original robot to V13 , So I decided to rewrite the bot.
I don’t know how to get all Intents at once I tried Intents.all but it didn't work this is my code
const { Client, Intents, MessageEmbed } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
const cofing = require("./cofig.json");
client.on('ready', () => {
console.log("================");
console.log("|i am ready|");
console.log("================");
});
client.on('message', async message => {
if(message.content === 'test'){
console.log("test")
}
});
client.login(cofing.token);
If you could tell me how to write this, I would be very grateful
Share Improve this question asked Aug 15, 2021 at 11:27 yorukotyorukot 1021 gold badge2 silver badges8 bronze badges 1-
1
Do you have a typo at
3:26
? It looks like you meanconfig.json
instead ofcofig.json
. – Onyx Commented Feb 25, 2022 at 18:48
2 Answers
Reset to default 4First of all:
There is a small error in your message event (client.on('message', ... )
), it's no longer 'message', but 'messageCreate' in v13, so keep in mind u have to update that.
About the intents: If you would like to use all intents (which I don't remend), you can define all the intents in one intent via a Bitfield, you do this with the following code:
const allIntents = new Intents(7796);
const client = new Client({ intents: allIntents });
FYI: First in the beginning of v13 there was a flag called ALL
(Intents.FLAGS.ALL), but that was removed afterwards, so this is the alternative to it.
const {Client,intents,Collection, DiscordAPIError, Guild} = require("discord.js") const client = new Client ({intents:[7796]})
The Intents: 32767 Is Not Working Anymore