From ca7489fd8f17dbd437709bc81e3bad8ffef94345 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 18 Dec 2012 02:03:24 +0100 Subject: [PATCH] super useful plugin that shuffles the message you send. --- plugins/shuffle.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/shuffle.py diff --git a/plugins/shuffle.py b/plugins/shuffle.py new file mode 100644 index 00000000..beba0769 --- /dev/null +++ b/plugins/shuffle.py @@ -0,0 +1,11 @@ +from plugin import BasePlugin +from random import shuffle + +class Plugin(BasePlugin): + def init(self): + self.add_event_handler('muc_say', self.shuffle) + + def shuffle(self, msg, tab): + split = msg['body'].split() + shuffle(split) + msg['body'] = ' '.join(split)