Rnd module: fix random choice between 0 possibility
This commit is contained in:
parent
7a55840aeb
commit
d985b71373
@ -9,4 +9,7 @@ def load(context):
|
|||||||
add_hook("cmd_hook", Hook(cmd_choice, "choice"))
|
add_hook("cmd_hook", Hook(cmd_choice, "choice"))
|
||||||
|
|
||||||
def cmd_choice(msg):
|
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!")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user