首页 > 解决方案 > 语音通道错误?“错误:未在 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

标签: javascriptdiscorddiscord.js

解决方案


推荐阅读