【发布时间】:2019-01-11 10:46:23
【问题描述】:
我试图让我的机器人在会员的 VC 中播放音乐,但它所做的只是下载会员尝试播放的歌曲,加入语音频道,然后立即转到我的 dispatcher.on("end", () => {}) 功能。歌曲的路径是正确的。如果我尝试直接在 Windows 上播放这首歌,它可以工作,但机器人甚至什么都不播放。我安装了 FFmpeg,使用 yarn add node-opus 安装了 node-opus,老实说,我不知道为什么它不起作用。
message.member.voiceChannel.join()
.then(connection => {
const dispatcher = connection.playFile('C:\Users\ameij\OneDrive\programming\promo\ytdl\song.mp3');
dispatcher.on("end", () => {
this.message.channel.send('Finished Playing.')
dispatcher.end();
this.message.member.voiceChannel.leave();
})
})
.catch(console.error);
【问题讨论】:
标签: node.js discord.js