Skip to content

Commit

Permalink
Fix Ranker Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeDailey committed Sep 26, 2020
1 parent 354e816 commit 6f771c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions cogs/lobby_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,20 @@ async def shuffle(self, ctx: Context):
)

@command()
async def ranked(self, ctx: Context, option: str):
async def ranked(self, ctx: Context):
await self.get_lobby_then(
ctx,
lambda lobby: lobby.show_next_match(get_ranker(ctx.channel)),
)

@command()
async def leaderboard(self, ctx: Context, option: str):
then = option_switch(
ctx.channel,
option,
{
"list": lambda l: l.show_ranking(filter_lobby=False),
"list-lobby": lambda l: l.show_ranking(filter_lobby=True),
None: lambda l: l.show_next_match(get_ranker(ctx.channel)),
"lobby": lambda l: l.show_ranking(filter_lobby=True),
None: lambda l: lambda l: l.show_ranking(filter_lobby=False),
},
)

Expand Down
2 changes: 1 addition & 1 deletion utils/option_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ def option_switch(channel: TextChannel, option, cases: Dict[str, Any]):
options = ["None"]
else:
options = filter(cases.keys())
raise UsageException.unexpected_option(channel, options)
raise UsageException.unexpected_option(channel, option, options)

return cases[option]

0 comments on commit 6f771c4

Please sign in to comment.