From dfa4c49d6864f4c9e0e69a061808699b21b98249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9munaire?= Date: Mon, 7 Jan 2013 12:22:07 +0100 Subject: [PATCH] New module rnd to make choice --- modules/rnd.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 modules/rnd.py diff --git a/modules/rnd.py b/modules/rnd.py new file mode 100644 index 0000000..198983c --- /dev/null +++ b/modules/rnd.py @@ -0,0 +1,12 @@ +# coding=utf-8 + +import random + +nemubotversion = 3.3 + +def load(context): + from hooks import Hook + add_hook("cmd_hook", Hook(cmd_choice, "choice")) + +def cmd_choice(msg): + return Response(msg.sender, random.choice(msg.cmds[1:]), channel=msg.channel)