diff --git a/royalnet/commands/ping.py b/royalnet/commands/ping.py index 9ecb5a41..87d689e5 100644 --- a/royalnet/commands/ping.py +++ b/royalnet/commands/ping.py @@ -1,11 +1,19 @@ -from ..utils import Command, CommandArgs, Call +import asyncio +from ..utils import Command, CommandArgs, Call, InvalidInputError class PingCommand(Command): command_name = "ping" command_description = "Ping pong!" - command_syntax = "" + command_syntax = "[time_to_wait]" async def common(self, call: Call): + try: + time = int(call.args[0]) + except InvalidInputError: + time = 0 + except ValueError: + raise InvalidInputError("time_to_wait is not a number") + await asyncio.sleep(time) await call.reply("🏓 Pong!")