#where i can get a basic text bot i find
1 messages · Page 1 of 1 (latest)
`const { Client, Intents } = require("discord.js");
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
});
client.on("ready", () => {
console.log("I am ready!");
});
client.on("messageCreate", (message) => {
if (message.content.startsWith("ping")) {
message.channel.send("pong!");
}
});
client.login("SuperSecretBotTokenHere");`
this is the code, but it mark me a error
`intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
^
TypeError: Cannot read properties of undefined (reading 'FLAGS')`
Tag suggestion for @rotund sparrow:
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined
• All SCREAMING_SNAKE_CASE enums have been changed to PascalCase
• Intents: Intents.FLAGS.GUILD_MESSAGES -> GatewayIntentBits.GuildMessages
• Permissions: Permissions.FLAGS.SEND_MESSAGES -> PermissionFlagsBits.SendMessages
Suggestion for @rotund sparrow:
Additional Information: Updating from v13 to v14
read more
it´s 14
i guess
{ "dependencies": { "discord.js": "^14.9.0" } }
i find this
I think you’ll be better off just reading the official discordjs guide
sure that explanation is fine, but the provided code in their sample bot is outdated so keep that in mind
where i can find a example?
on the guide