summaryrefslogtreecommitdiff
path: root/plugins/amsg.py
blob: 4cd6c0555eaa3d6223ea47d6e1fe58d7208d422a (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
25
26
27
28
29
30
31
32
33
34
35
"""
This plugin broadcasts a message to all your joined rooms.

.. note:: With great power comes great responsibility.
          Use with moderation.

Command
-------

.. glossary::

    /amsg
        **Usage:** ``/amsg <message>``

        Broadcast a message.


"""
from poezio.plugin import BasePlugin
from poezio.tabs import MucTab


class Plugin(BasePlugin):
    def init(self):
        self.api.add_command(
            'amsg',
            self.command_amsg,
            usage='<message>',
            short='Broadcast a message',
            help='Broadcast the message to all the joined rooms.')

    def command_amsg(self, args):
        for room in self.core.tabs:
            if isinstance(room, MucTab) and room.joined:
                room.command_say(args)