poezio/plugins/shuffle.py
mathieui 3c688335af Fix #2453 (malformed stanzas with stupid plugins)
remove xhtml prior to performing stuff
2014-04-01 23:04:10 +02:00

16 lines
430 B
Python

"""
Shuffle the words in every message you send in a :ref:`muctab`
(may/should confuse the reader).
"""
from plugin import BasePlugin
from random import shuffle
import xhtml
class Plugin(BasePlugin):
def init(self):
self.api.add_event_handler('muc_say', self.shuffle)
def shuffle(self, msg, tab):
split = xhtml.clean_text(msg['body']).split()
shuffle(split)
msg['body'] = ' '.join(split)