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
First 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 recommend), you can define all the intents in one intent via a Bitfield , you do this with the following code:
const allIntents = new Intents(32767);
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.