不和谐.js语音机器人在播放本地 mp3 文件时被切断



我的机器人播放 mp3 声音,但它在接近结束时被切断,尤其是对于短(<2s(文件。

多次重新安装 ffmpeg

client.on('message', message => {
// Voice only works in guilds, if the message does not come from a guild,
// we ignore it
if (!message.guild) return;
if (message.content === '!sound') {
// Only try to join the sender's voice channel if they are in one themselves
if (message.member.voiceChannel) {
message.member.voiceChannel.join()
.then(connection => { // Connection is an instance of VoiceConnection
const dispatcher = connection.playFile('C:/Users/X/Desktop/my-bot/Sounds/SJW2.mp3');
dispatcher.on("end", end => {connection.disconnect});
})
.catch(console.log);
client.on('end', () => {
// The song has finished
});

没有错误,声音只是在文件末尾附近被切断。

尝试使用 opus 语音。此外,您的主机的互联网速度也会影响它。这可能是由于高延迟

最新更新