help create my discord bot on nodejs and discord.js
my code
require('dotenv').config();
const { Client, Intents } = require('discord.js');
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES
]
});
const { YoutubeNotifier } = require('discord-bot-youtube-notifications');
const notifier = new YoutubeNotifier({
youtubeApiKey: process.env.YOUTUBE_API_KEY,
discordClient: client,
channel: process.env.CHAT_ID,
});
client.on('ready', () => {
console.log('Application start!')
notifier.start();
});
client.login(process.env.SECRET_TOKEN);
![No description](https://cdn.answeroverflow.com/1214322334089875486/image.png)
7 Replies
- 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!
- ✅
Marked as resolved by OPYou are using v13 code while having v14 installed it seems
Not sure where you got this from
please help
Tag suggestion for @hydrovskiy:
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
Exactly what the previous helper said, check your discord.js version in package.json
Help no need. This working
then click "mark post as solved" button