summaryrefslogtreecommitdiff
path: root/plugins/shuffle.py
blob: edf13083e6af292fad5badd2a12aea846a1a6ad2 (plain)
1
2
3
4
5
6
7
8
9
10
11
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)