summaryrefslogtreecommitdiff
path: root/plugins/revstr.py
blob: 4d5720dc61695bb30009509d9eb34c8192d08f38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
Reverse everything you say.

Installation
------------

You only have to load the plugin:

.. code-block:: none

    /load revstr


"""
from plugin import BasePlugin

class Plugin(BasePlugin):
    def init(self):
        self.api.add_event_handler('muc_say', self.revstr)
        self.api.add_event_handler('conversation_say', self.revstr)
        self.api.add_event_handler('private_say', self.revstr)

    def revstr(self, msg, tab):
        msg['body'] = msg['body'][::-1]