nemubot/modules/rnd.py

19 lines
364 B
Python
Raw Normal View History

2013-01-07 11:22:07 +00:00
# coding=utf-8
2014-08-27 23:39:31 +00:00
"""Help to make choice"""
2013-01-07 11:22:07 +00:00
import random
from hooks import hook
2013-01-07 11:22:07 +00:00
2014-08-13 13:53:55 +00:00
nemubotversion = 3.4
2013-01-07 11:22:07 +00:00
from more import Response
@hook("cmd_hook", "choice")
2013-01-07 11:22:07 +00:00
def cmd_choice(msg):
if len(msg.cmds) > 1:
return Response(random.choice(msg.cmds[1:]), channel=msg.channel, nick=msg.nick)
else:
raise IRCException("indicate some terms to pick!")