From 69fde9b21a7a343c4a32a6dd49a5cb548539cb2e Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 17 May 2020 03:27:01 +0100 Subject: [PATCH] `ConnectedPenguinConverter` now accepts usernames --- houdini/converters.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/houdini/converters.py b/houdini/converters.py index 55b2cfe..e780401 100644 --- a/houdini/converters.py +++ b/houdini/converters.py @@ -10,6 +10,7 @@ from houdini.data.item import Item from houdini.data.pet import PenguinPuffle, Puffle from houdini.data.room import Room from houdini.data.stamp import Stamp +from houdini.data.permission import Permission class ChecklistError(Exception): @@ -229,10 +230,13 @@ class ConnectedPenguinConverter(IConverter): or none if the player is offline""" async def convert(self, ctx): - penguin_id = int(ctx.argument) - if penguin_id in ctx.p.server.penguins_by_id: - return ctx.p.server.penguins_by_id[penguin_id] - return None + try: + try: + return ctx.p.server.penguins_by_id[int(ctx.argument)] + except ValueError: + return ctx.p.server.penguins_by_username[ctx.argument.lower()] + except KeyError: + return None class ConnectedIglooConverter(IConverter):