0
Discord 봇에 대한 명령 중 하나는 현재 사용자의 음성 채널에서 미리 정의 된 음악 클립을 재생하는 것입니다. 봇은 연결할 수 있지만 노래를 재생하는 대신 순간적으로 종료합니다. 나는 connection.playStream
과 connection.playFile
을 모두 사용해 보았는데, 둘 다 똑같은 (부족한) 출력을 반환하는 것처럼 보입니다. 일종의 의존성이 없거나 코드가 잘못 작성된 것입니까? 어떤 도움이라도 대단히 감사하겠습니다!Discord.js 및 ytdl의 알 수없는 문제로 오디오 재생을 완전히 건너 뜁니다.
const Discord = require('discord.js');
const ytdl = require('ytdl-core');
const client = new Discord.Client();
const streamOptions = { seek: 0, volume: 1};
client.on('ready',() => {
console.log('Login Success');
});
client.on('message', message => {
if (message.content === '$vaporwave') {
if (!message.guild) return;
if(message.member.voiceChannel) {
message.member.voiceChannel.join().then(connection => {
console.log("joined channel");
//const stream = ytdl('https://www.youtube.com/watch?v=cU8HrO7XuiE', { filter : 'audioonly' });
const dispatcher = connection.playFile('./mcp420.mp3');
//const dispatcher = connection.playStream(stream, streamOptions);
dispatcher.on("end", end => {
console.log("left channel");
message.member.voiceChannel.leave();
});
}).catch(err => console.log(err));
}
}
});
- NPM의 v4.6.1
- Node.js를 v8.9.1
- FFMPEG v3.2.8-1, 내가
sodium
이없는 한 것을 발견 할 수 있었다dispatcher.on('error', console.error);
를 사용하여