Skip to content

Commit

Permalink
add: auto fallback to normal mode if region not satisfied
Browse files Browse the repository at this point in the history
  • Loading branch information
RainyXeon committed Sep 23, 2024
1 parent 21392dc commit c9a77d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rainlink",
"version": "1.2.2",
"version": "1.2.3",
"description": "Another lavalink wrapper but focus on stability and rich features",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/Manager/RainlinkPlayerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export class RainlinkPlayerManager extends RainlinkDatabase<RainlinkPlayer> {
.filter(([, node]) => node.options.region)
.map(([, node]) => node)
if (!getCustomNode && voiceHandler.region && reigonedNode.length !== 0) {
const node = reigonedNode.filter((node) => node.options.region == voiceHandler.region)
if (node) getCustomNode = await this.manager.nodes.getLeastUsed(node)
const nodes = reigonedNode.filter((node) => node.options.region === voiceHandler.region)
if (nodes.length !== 0) getCustomNode = await this.manager.nodes.getLeastUsed(nodes)
}
const node = getCustomNode ? getCustomNode : await this.manager.nodes.getLeastUsed()
if (!node) throw new Error('Can\'t find any nodes to connect on')
Expand Down
2 changes: 1 addition & 1 deletion src/Node/RainlinkNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class RainlinkNode {
const getDriver = this.manager.drivers.filter(
(driver) => driver.prototype.id === options.driver
)
if (!getDriver || getDriver.length == 0) {
if (!getDriver || getDriver.length == 0 || !options.driver) {
this.debug('No driver was found, using lavalink v4 driver instead')
this.driver = new Lavalink4(manager, this)
} else {
Expand Down

0 comments on commit c9a77d8

Please sign in to comment.