Rnd module: fix random choice between 0 possibility

This commit is contained in:
nemunaire 2014-08-06 16:10:10 +02:00
parent 7a55840aeb
commit d985b71373

View File

@ -9,4 +9,7 @@ def load(context):
add_hook("cmd_hook", Hook(cmd_choice, "choice"))
def cmd_choice(msg):
return Response(msg.sender, random.choice(msg.cmds[1:]), channel=msg.channel, nick=msg.nick)
if len(msg.cmds) > 1:
return Response(msg.sender, random.choice(msg.cmds[1:]), channel=msg.channel, nick=msg.nick)
else:
raise IRCException("indicate some terms to pick!")