2013-04-13 20:33:06 +00:00
|
|
|
"""
|
|
|
|
Shuffle the words in every message you send in a :ref:`muctab`
|
|
|
|
(may confuse the reader).
|
|
|
|
|
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
|
|
|
You only have to load the plugin:
|
|
|
|
|
|
|
|
.. code-block:: none
|
|
|
|
|
|
|
|
/load shuffle
|
|
|
|
|
|
|
|
"""
|
2012-12-18 01:03:24 +00:00
|
|
|
from plugin import BasePlugin
|
|
|
|
from random import shuffle
|
|
|
|
|
|
|
|
class Plugin(BasePlugin):
|
|
|
|
def init(self):
|
2013-03-08 21:53:35 +00:00
|
|
|
self.api.add_event_handler('muc_say', self.shuffle)
|
2012-12-18 01:03:24 +00:00
|
|
|
|
|
|
|
def shuffle(self, msg, tab):
|
|
|
|
split = msg['body'].split()
|
|
|
|
shuffle(split)
|
|
|
|
msg['body'] = ' '.join(split)
|