How to use the deltachat.message.Message function in deltachat

To help you get started, we’ve selected a few deltachat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deltachat / deltabot / src / deltabot / pytestplugin.py View on Github external
def make_incoming_message(self, text, addr="Alice "):
            msg = Message.new_empty(self.account, "text")
            msg.set_text(text)
            name, routeable_addr = parseaddr(addr)
            contact = self.account.create_contact(email=routeable_addr, name=name)
            chat = self.account.create_chat_by_contact(contact)
            msg_in = chat.prepare_message(msg)
            return msg_in
github deltachat / deltabot / src / deltabot / reply.py View on Github external
def __init__(self, incoming_message, text, terminal=False):
        self.incoming_message = incoming_message
        self.chat = self.incoming_message.chat
        self.msg = Message.new_empty(self.chat.account, "text")
        self.msg.set_text(text)
        self.terminal = terminal
github deltachat / deltabot / src / deltabot / bot.py View on Github external
def get_chat(self, ref):
        """ Return a 1:1 chat (creating one if needed) from the specified ref object.

        ref can be a Message, Contact, email address string or chat-id integer.
        """
        if isinstance(ref, dc.message.Message):
            return self.account.create_chat_by_message(ref)
        elif isinstance(ref, dc.contact.Contact):
            return self.account.create_chat_by_contact(ref)
        elif isinstance(ref, str) and '@' in ref:
            return self.account.create_contact(ref).get_chat()
        elif type(ref) is int:
            try:
                return self.account.get_chat_by_id(ref)
            except ValueError:
                return None