所以基本上我有 这个问题,我得到了一个解决方案";但它没有用,所以我找到了一个修复程序,将 highWaterMark 添加到我的代码中,以便流保持打开更长时间或任何 idk,所以这就是我的代码目前的样子
So basically i had this issue and i got given a "solution" but it didn't work, so i found a fix and that was adding highWaterMark to my code so the stream stays open longer or whatever idk, so this is what my code looks like currently
const dispatcher = serverQueue.connection.play(ytdl(song.url, {
filter:"audioonly",
highWaterMark: 1<<25 })
.on("finish", () => {
const shiffed = serverQueue.songs.shift();
if (serverQueue.loop === true) {
serverQueue.songs.push(shiffed);
};
play(guild, serverQueue.songs[0]);
})
.on("error", error => console.error(error)));
dispatcher.setVolume(serverQueue.volume / 100);
但是现在我的问题是这首歌会播放大约 10 秒然后就停止了,我不知道为什么这只会让我的问题变得更糟,因为对于我看到的每个使用此解决方案的人来说,它都非常有效.
but now my issue is that the song will play for like 10 seconds then just stop, i have no idea why this just made my issue worse because for everyone i seen that used this solution it worked perfectly.
您可能想尝试将流的类型更改为 opus :
You might want to try to change the type of the stream to opus :
serverQueue.connection.play(ytdl(song.url, { filter:"audioonly", type: 'opus' });
这篇关于Discord Music bot - 我播放的歌曲在结束前 10-20 秒停止,所以我添加了 highWaterMark,现在这首歌几乎没有播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
discord.js v12:我如何等待 DM 频道中的消息?discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 频道中的消息?)
如何让我的机器人提及发出该机器人命令的人how to make my bot mention the person who gave that bot command(如何让我的机器人提及发出该机器人命令的人)
如何修复必须使用导入来加载 ES 模块 discord.jsHow to fix Must use import to load ES Module discord.js(如何修复必须使用导入来加载 ES 模块 discord.js)
如何列出来自特定服务器的所有成员?How to list all members from a specific server?(如何列出来自特定服务器的所有成员?)
Discord bot:修复“找不到 FFMPEG"Discord bot: Fix ‘FFMPEG not found’(Discord bot:修复“找不到 FFMPEG)
使用 discord.js 加入 discord 服务器时的欢迎消息Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服务器时的欢迎消息)