+ self.log = bot.log.getChild(self.__class__.__name__)
+
+ def send(self, dest, msg, mtype='chat'):
+ """Send msg to dest
+
+ :param str dest: Message recipient
+ :param dict,str msg: Message to send (use dict for xhtml-im)
+
+ .. note::
+ if **msg** is a :py:obj:`dict` to provide xhmlt-im massages::
+
+ msg = {
+ mbody: 'text',
+ mhtml: '<b>text</b>, # optional'
+ }
+ """
+ if isinstance(msg, str):
+ msg = {'mbody': msg}
+ msg.setdefault('mhtml', None)
+ self.bot.send_message(mto=dest,
+ mtype=mtype,
+ **msg)
+
+ def reply(self, rcv, msg):
+ """Smart reply to message received.
+
+ Replies ``msg`` in private or on the muc depending on ``rcv``
+
+ :param rcv: The received message (slixmpp object)
+ :param dict,str msg: The message to reply, refer to :py:obj:`sid.plugin.Plugin.send` for ``msg`` format
+ """
+ to = rcv['from']
+ if rcv['type'] == 'groupchat':
+ to = rcv['mucroom']
+ self.send(to, msg, mtype=rcv['type'])