如何使用Discordie一次连接到多个语音连接

每当我尝试让我的机器人连接到两个语音连接,它断开了前一个。 有没有办法使用Discordie连接到多个语音套接字? 如果是这样,怎么样?

这是我的代码:

const Discordie = require("discordie"); const fs = require('fs'); const Events = Discordie.Events; const client = new Discordie({autoReconnect: true}); client.autoReconnect.enable(); client.connect({token: token}); var channels = new Array(); var connections = new Object(); client.Dispatcher.on(Events.GATEWAY_READY, e => { client.User.setStatus("online"); console.log("Connected as: " + client.User.username); process.title = "Discord Bot: " + client.User.username; client.Channels.forEach((channel) => { if (channel.name == 'cantina') channels.push(channel.id); }); r.context.client = client; r.displayPrompt(); }); client.Dispatcher.on(Events.CHANNEL_CREATE, (e) => { if (e.channel.name == 'cantina') { channels.push(e.channel.id); } }); client.Dispatcher.on(Events.VOICE_CHANNEL_JOIN, (e) => { if (channels.includes(e.channel.id) && e.channel.members.length <= 2) { e.channel.join().then((info) => { var connection = info.voiceConnection; connections[e.channel.id] = { channel: e.channel, connectionInfo : info, connection: connection } play(e.channel, connection); }); } }); function play(channel, connection) { //function to play the song } 

查看有关“分片”的不一致文档中的此部分: https : //discordapp.com/developers/docs/topics/gateway#sharding

随着机器人的增长并被添加到越来越多的行会中,一些开发人员可能会发现有必要将他们的机器人操作的一部分拆分成不同的逻辑进程。 因此,Discord网关实现了用户控制的guild-sharding方法,允许通过多个网关连接拆分事件 。 公会分片完全由用户控制,不需要单独连接之间的状态共享来操作。

这是指网关连接,但根据本节: https : //discordapp.com/developers/docs/topics/voice-connections#voice

语音连接以与网关连接类似的方式操作,但是它们在不同的有效载荷集上操作,并且利用单独的基于UDP的连接来进行语音数据传输。

所以,你可以推断,如果多个网关连接可能和语音连接是相似的,那么是的,这是可能的。 无论是否可能使用不协调,我都无法在文档中find任何可以或不可以的东西。

如需更多帮助,请发布您正在尝试执行的代码示例,有人可能会在代码中发现问题。