poezio/plugins/shuffle.py
mathieui d676c2ee7b Move the plugins documentation
(use automodule directive & docstrings)
2013-04-13 22:33:06 +02:00

25 lines
496 B
Python

"""
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
"""
from plugin import BasePlugin
from random import shuffle
class Plugin(BasePlugin):
def init(self):
self.api.add_event_handler('muc_say', self.shuffle)
def shuffle(self, msg, tab):
split = msg['body'].split()
shuffle(split)
msg['body'] = ' '.join(split)