示例#1
0
文件: bot.py 项目: forcemain/Ludolph
 def msg_send(self, mto, mbody, mfrom=None, mnick=None, **kwargs):
     """
     Create message and send it.
     """
     return OutgoingLudolphMessage.create(mbody, **kwargs).send(self,
                                                                mto,
                                                                mfrom=mfrom,
                                                                mnick=mnick)
示例#2
0
文件: bot.py 项目: erigones/Ludolph
    def msg_resend(self, msg, **kwargs):
        """
        Re-send message to original recipient with optional delay.
        """
        defaults = {"mtype": msg.get("mtype", None), "msubject": msg.get("subject", None)}
        defaults.update(kwargs)

        return OutgoingLudolphMessage.create(msg["body"], **kwargs).send(self, msg["from"], mfrom=msg["to"])
示例#3
0
文件: bot.py 项目: erigones/Ludolph
    def msg_reply(self, msg, mbody, preserve_msg=False, **kwargs):
        """
        Set message reply text and html, and send it.
        """
        if mbody is None:
            return None  # Command performs custom message sending

        if preserve_msg:
            msg = self.msg_copy(msg)

        return OutgoingLudolphMessage.create(mbody, **kwargs).reply(msg)
示例#4
0
文件: bot.py 项目: forcemain/Ludolph
    def msg_reply(self, msg, mbody, preserve_msg=False, **kwargs):
        """
        Set message reply text and html, and send it.
        """
        if mbody is None:
            return None  # Command performs custom message sending

        if preserve_msg:
            msg = self.msg_copy(msg)

        return OutgoingLudolphMessage.create(mbody, **kwargs).reply(msg)
示例#5
0
文件: bot.py 项目: erigones/Ludolph
    def msg_broadcast(self, mbody, **kwargs):
        """
        Send message to all users in roster.
        """
        msg = OutgoingLudolphMessage.create(mbody, **kwargs)
        i = 0

        for jid in self.client_roster:
            if not (jid == self.boundjid.bare or jid in self.broadcast_blacklist):
                msg.send(self, jid)
                i += 1

        return i
示例#6
0
文件: bot.py 项目: forcemain/Ludolph
    def msg_broadcast(self, mbody, **kwargs):
        """
        Send message to all users in roster.
        """
        msg = OutgoingLudolphMessage.create(mbody, **kwargs)
        i = 0

        for jid in self.client_roster:
            if not (jid == self.boundjid.bare
                    or jid in self.broadcast_blacklist):
                msg.send(self, jid)
                i += 1

        return i
示例#7
0
文件: bot.py 项目: forcemain/Ludolph
    def msg_resend(self, msg, **kwargs):
        """
        Re-send message to original recipient with optional delay.
        """
        defaults = {
            'mtype': msg.get('mtype', None),
            'msubject': msg.get('subject', None)
        }
        defaults.update(kwargs)

        return OutgoingLudolphMessage.create(msg['body'],
                                             **kwargs).send(self,
                                                            msg['from'],
                                                            mfrom=msg['to'])
示例#8
0
文件: bot.py 项目: erigones/Ludolph
 def msg_send(self, mto, mbody, mfrom=None, mnick=None, **kwargs):
     """
     Create message and send it.
     """
     return OutgoingLudolphMessage.create(mbody, **kwargs).send(self, mto, mfrom=mfrom, mnick=mnick)