problem with creating a bot in code
у меня возникла эта проблема TypeError: Cannot read properties of undefined (reading 'FLAGS')
at Object.<anonymous> (C:\Users\Lenovo\main.js:6:17)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
в этом кодеconst { Client, Intents } = require('discord.js');
const ytdl = require('ytdl-core');
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES
]
});
client.once('ready', () => {
console.log('Бот готов!');
});
console.log(client.options.intents);
client.on('messageCreate', async message => {
if (!message.content.startsWith('!play')) return;
const voiceChannel = message.member.voice.channel;
if (!voiceChannel) {
return message.reply('Вы должны быть в голосовом канале, чтобы использовать эту команду!');
}
const connection = await voiceChannel.join();
const args = message.content.split(' ');
const songURL = args[1];
const dispatcher = connection.play(ytdl(songURL, { filter: 'audioonly' }));
dispatcher.on('finish', () => {
voiceChannel.leave();
});
}); я хочу узнать как решить проблему
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!we do not support tos violations
streaming from youtube to discord would be against youtube's tos and by extension discord's tos
that is, you can’t help with my problem?
or you don't know?
we do not help with tos violations
and who can
Intents
should be replaced with IntentsBitField
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View