Skip to content

Commit

Permalink
Fix to client.get_player where checks for shard and regional option…
Browse files Browse the repository at this point in the history
…s were incorrect.

Bumped version.
  • Loading branch information
EvieePy committed Oct 22, 2019
1 parent c510536 commit f1dcfc5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
requirements.append('sphinxcontrib-websupport')
requirements.append('Pygments')

version = '0.3.0'
version = '0.3.01'

readme = ''
with open('README.rst') as f:
Expand Down
2 changes: 1 addition & 1 deletion wavelink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__author__ = 'EvieePy'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 (c) EvieePy'
__version__ = '0.3.0'
__version__ = '0.3.01'

from .client import Client
from .errors import *
Expand Down
5 changes: 3 additions & 2 deletions wavelink/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ def get_player(self, guild_id: int, *, cls=None, node_id=None) -> Player:
if node.region.lower() == str(guild.region).lower():
region_options.append(node)

if not shard_options or region_options:
if not shard_options and not region_options:
# Sort by len of node players
node = sorted(nodes, key=lambda n: len(n.players))[0]
player = cls(self.bot, guild_id, node)
node.players[guild_id] = player
Expand All @@ -256,7 +257,7 @@ def get_player(self, guild_id: int, *, cls=None, node_id=None) -> Player:

best = [n for n in shard_options if n in region_options]
if best:
node = sorted(best, key=lambda _: len(_.players))[0]
node = sorted(best, key=lambda n: len(n.players))[0]
elif shard_options:
node = sorted(shard_options, key=lambda n: len(n.players))[0]
else:
Expand Down

0 comments on commit f1dcfc5

Please sign in to comment.