nemubot/modules/rnd.py
nemunaire 41da1c0780 Response class is now part of 'more' module.
This commit prepare the new message flow based on protocol independent messages.

	This commit changes the module API: you need to import the Response class manually at the begining of our module.
2014-09-27 12:39:44 +02:00

19 lines
364 B
Python

# coding=utf-8
"""Help to make choice"""
import random
from hooks import hook
nemubotversion = 3.4
from more import Response
@hook("cmd_hook", "choice")
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!")