2013-04-13 20:33:06 +00:00
|
|
|
"""
|
|
|
|
This plugin broadcasts a message to all your joined rooms.
|
2012-02-07 00:12:21 +00:00
|
|
|
|
2013-04-13 20:33:06 +00:00
|
|
|
.. note:: With great power comes great responsability.
|
|
|
|
Use with moderation.
|
|
|
|
|
|
|
|
Command
|
|
|
|
-------
|
|
|
|
|
|
|
|
.. glossary::
|
|
|
|
|
|
|
|
/amsg
|
|
|
|
**Usage:** ``/amsg <message>``
|
|
|
|
|
2014-03-27 22:45:47 +00:00
|
|
|
Broadcast a message.
|
|
|
|
|
2013-04-13 20:33:06 +00:00
|
|
|
|
|
|
|
"""
|
2016-06-27 23:10:52 +00:00
|
|
|
from poezio.plugin import BasePlugin
|
|
|
|
from poezio.tabs import MucTab
|
2012-02-07 00:12:21 +00:00
|
|
|
|
2018-08-15 11:13:17 +00:00
|
|
|
|
2012-02-07 00:12:21 +00:00
|
|
|
class Plugin(BasePlugin):
|
|
|
|
def init(self):
|
2018-08-15 11:13:17 +00:00
|
|
|
self.api.add_command(
|
|
|
|
'amsg',
|
|
|
|
self.command_amsg,
|
|
|
|
usage='<message>',
|
|
|
|
short='Broadcast a message',
|
|
|
|
help='Broadcast the message to all the joined rooms.')
|
2012-02-07 00:12:21 +00:00
|
|
|
|
|
|
|
def command_amsg(self, args):
|
|
|
|
for room in self.core.tabs:
|
|
|
|
if isinstance(room, MucTab) and room.joined:
|
|
|
|
room.command_say(args)
|