night of death
night of death
DIAdiscord.js - Imagine an app
Created by night of death on 11/16/2023 in #djs-questions
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(); }); }); я хочу узнать как решить проблему
10 replies