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
|
|
|
|
|
2015-01-04 22:57:09 +00:00
|
|
|
from nemubot.exception import IRCException
|
2015-01-03 19:34:44 +00:00
|
|
|
from nemubot.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
|
|
|
|
2014-09-26 16:00:22 +00:00
|
|
|
from more import Response
|
|
|
|
|
2014-11-13 01:51:49 +00:00
|
|
|
|
2014-08-12 18:10:19 +00:00
|
|
|
@hook("cmd_hook", "choice")
|
2013-01-07 11:22:07 +00:00
|
|
|
def cmd_choice(msg):
|
2015-07-10 21:09:54 +00:00
|
|
|
if not len(msg.args):
|
2014-08-06 14:10:10 +00:00
|
|
|
raise IRCException("indicate some terms to pick!")
|
2015-07-10 21:09:54 +00:00
|
|
|
|
|
|
|
return Response(random.choice(msg.args),
|
|
|
|
channel=msg.channel,
|
|
|
|
nick=msg.nick)
|