【发布时间】:2019-04-11 11:51:35
【问题描述】:
我一直在尝试让机器人在 Discord 上发送声音,但我无法让它工作。我复制粘贴了在我的 Arch Linux 服务器上的 Windows 上运行的同一段代码,机器人简单地加入,然后立即离开。
这是我尝试过的:
const fs = require('fs');
client.on('message', msg => {
var VC = msg.member.voiceChannel;
if (!VC)
{
msg.channel.send('This command only works in a voice channel');
}
VC.join().then(connection =>
{
const dispatcher = connection.playFile('mysoundfile.mp3');
dispatcher.on("end", end => {VC.leave()});
})
}
我就是不知道出了什么问题,而且我已经对这个问题进行了长时间的谷歌研究。
谢谢。
【问题讨论】:
-
您确定文件
mysoundfile.mp3存在于您的服务器上吗? -
是的,我确定我已经将计算机上的目录复制/粘贴到它上面