Skip to content

Commit

Permalink
Update getLavalink.js
Browse files Browse the repository at this point in the history
  • Loading branch information
LewdHuTao authored Mar 1, 2023
1 parent 25aac78 commit 7351c92
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions util/getLavalink.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
* @returns {import("erela.js").Node | undefined}
*/
module.exports = async (client) => {
return new Promise((resolve) => {
for (let i = 0; i < client.manager.nodes.size; i++) {
const node = client.manager.nodes.array()[i];
if (node.connected) {
resolve(node);
}
}
resolve(undefined);
});
return new Promise((resolve) => {
for (let i = 0; i < client.manager.nodes.size; i++) {
client.manager.nodes.forEach((node) => {
if (node.connected) resolve(node);
});
}
resolve(undefined);
});
};

0 comments on commit 7351c92

Please sign in to comment.