javascript - 语音通道错误?“错误:未在 15 秒内建立连接。”
问题描述
当我的不和谐机器人加入语音频道时,然后离开。几分钟后,机器人崩溃并显示“错误:未在 15 秒内建立连接”。
我尝试更新 discord.js,但不起作用。重启,什么都没有。我不认为这是我的机器人,但也许是不和谐的错?我现在只是猜测。
这是我加入 VC 的代码:
voiceChannel.join().then(connection => {
currentStream = connection.playStream(ytdl(
args[0],
{ filter: 'audioonly' }
)).catch (err => {
channelmsg.send(`I was unable to do this command, make sure I have permission to do this. \`ERR: 0xP00002\``)
return
});
});
这是我离开 VC 的代码:
if (voiceChannel) {
voiceChannel.leave();
var embed = new Discord.RichEmbed()
.setColor(0xff0000)
.addField('**:play_pause: Music Command.**', `I have now left the voice channel. :wave:`)
channelmsg.send({embed});
语音通道也只是message.member.voiceChannel;
这是我在机器人离开 VC 时遇到的错误......
throw er; // Unhandled 'error' event
^
Error: Error: Connection not established within 15 seconds.
at VoiceConnection.authenticateFailed (/srv/samba/share/(bot_name)/node_modules/discord.js/src/client/voice/VoiceConnection.js:263:26)
at connectTimeout.client.setTimeout (/srv/samba/share/(bot_name)/node_modules/discord.js/src/client/voice/VoiceConnection.js:285:18)
at Timeout.setTimeout (/srv/samba/share/(bot_name)/node_modules/discord.js/src/client/Client.js:434:7)
at listOnTimeout (internal/timers.js:535:17)
at processTimers (internal/timers.js:479:7)
Emitted 'error' event at:
at VoiceConnection.authenticateFailed (/srv/samba/share/(bot_name)/node_modules/discord.js/src/client/voice/VoiceConnection.js:263:12)
at connectTimeout.client.setTimeout (/srv/samba/share/(bot_name)/node_modules/discord.js/src/client/voice/VoiceConnection.js:285:18)
[... lines matching original stack trace ...]
at processTimers (internal/timers.js:479:7)
如果有人知道如何修复它,或者是否有已知的 discord.js 新版本可以解决此问题,请在评论中告诉我。
谢谢!-ktg
解决方案
推荐阅读
- flutter - 如何强制构建另一个小部件?
- compiler-construction - codechef 编译器是如何工作的?
- arrays - 如何将 mongodb::Bson::Document 转换为字节数组(Vec
) 在锈 - javascript - 隐藏的侧边栏,扩大我的视口,如何改变它?
- docker - 带有 Docker 的 mediasoup v3
- python - 使用 google_images_download 下载图片时出错
- typescript - 术语“tsc”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。谁能告诉我有什么问题?
- c# - 如何在 C# 中调用 Web 服务
- c++ - 在 Visual Studio Code 中编译 Hello World C++ 代码
- javascript - 如何使用丰富的中介 WSO2 动态添加 json 元素?