2013-04-13 20:33:06 +00:00
|
|
|
"""
|
|
|
|
Shuffle the words in every message you send in a :ref:`muctab`
|
2014-03-27 22:45:47 +00:00
|
|
|
(may/should confuse the reader).
|
2013-04-13 20:33:06 +00:00
|
|
|
"""
|
2016-06-27 23:10:52 +00:00
|
|
|
from poezio.plugin import BasePlugin
|
2012-12-18 01:03:24 +00:00
|
|
|
from random import shuffle
|
2016-06-27 23:10:52 +00:00
|
|
|
from poezio import xhtml
|
2012-12-18 01:03:24 +00:00
|
|
|
|
|
|
|
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):
|
2014-04-01 21:04:10 +00:00
|
|
|
split = xhtml.clean_text(msg['body']).split()
|
2012-12-18 01:03:24 +00:00
|
|
|
shuffle(split)
|
|
|
|
msg['body'] = ' '.join(split)
|