]> kaliko git repositories - sid.git/blobdiff - sid/plugin.py
Moved the send logic to Plugin
[sid.git] / sid / plugin.py
index 671df850cdd73ea3edf7420fcfcd0cfa21b4442b..2b49bc9da22c9d3a57f1c02a6793da770a3c1221 100644 (file)
@@ -21,6 +21,22 @@ class Plugin(object):
 
     def __init__(self, bot):
         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