]> kaliko git repositories - sid.git/blobdiff - sid/plugin.py
Moved the send logic to Plugin
[sid.git] / sid / plugin.py
index 15f43ab55e52a7a4fb3280d22abbc970d61ddfbf..2b49bc9da22c9d3a57f1c02a6793da770a3c1221 100644 (file)
@@ -23,5 +23,20 @@ class Plugin(object):
         self.bot = bot
         self.log = bot.log
 
+    def send(self, msg):
+        """
+        Send msg to the current groupchat defined in self.bot.room
+            msg = {
+                mbody: 'text',
+                mhtml: '<b>text</b>,  # optional'
+            }
+        """
+        if isinstance(msg, str):
+            msg = {'mbody':msg}
+        msg.setdefault('mhtml', None)
+        self.bot.send_message(mto=self.bot.room,
+                              mtype='groupchat',
+                              **msg)
+
     def shutdown(self):
         pass