Make bot name optional

This commit is contained in:
Juhani Krekelä 2019-05-10 19:54:30 +03:00
parent e86915927c
commit 1e5eb46239
1 changed files with 7 additions and 3 deletions

View File

@ -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 <type> <name>')
send('Usage: !bot add <type> [<name>]')
elif arg[1] == 'remove':
send('Usage: !bot remove <name>')
else: