From 1e5eb46239f50710323be9c786436371a670007e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Fri, 10 May 2019 19:54:30 +0300 Subject: [PATCH] Make bot name optional --- botcmd.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/botcmd.py b/botcmd.py index c203929..c0adac0 100644 --- a/botcmd.py +++ b/botcmd.py @@ -225,9 +225,13 @@ def parse_command(message, nick, irc): subc = message[1] if subc == 'add': - arg = args(2, 2) + arg = args([1, 2], 2) if arg is not None: - bot_type, name = arg + if len(arg) == 2: + bot_type, name = arg + else: + bot_type, = arg + name = bot_type if bot_type == 'rando': send_event((events.bot_add_rando, name)) else: @@ -329,7 +333,7 @@ def parse_command(message, nick, irc): send('No such subcommand !%s %s' % (arg[0], arg[1])) elif arg[0] == 'bot': if arg[1] == 'add': - send('Usage: !bot add ') + send('Usage: !bot add []') elif arg[1] == 'remove': send('Usage: !bot remove ') else: