send an image message and return the resulting Message instance. :param path: path to an image file. :raises ValueError: if message can not be send/chat does not exist. :returns: the resulting :class:`deltachat.message.Message` instance
(self, path)
| 310 | return Message.from_db(self.account, sent_id) |
| 311 | |
| 312 | def send_image(self, path): |
| 313 | """send an image message and return the resulting Message instance. |
| 314 | |
| 315 | :param path: path to an image file. |
| 316 | :raises ValueError: if message can not be send/chat does not exist. |
| 317 | :returns: the resulting :class:`deltachat.message.Message` instance |
| 318 | """ |
| 319 | mime_type = mimetypes.guess_type(path)[0] |
| 320 | msg = Message.new_empty(self.account, view_type="image") |
| 321 | msg.set_file(path, mime_type) |
| 322 | sent_id = lib.dc_send_msg(self.account._dc_context, self.id, msg._dc_msg) |
| 323 | if sent_id == 0: |
| 324 | raise ValueError("message could not be sent") |
| 325 | return Message.from_db(self.account, sent_id) |
| 326 | |
| 327 | def set_draft(self, message): |
| 328 | """set message as draft. |