send a text message and return the resulting Message instance. :param msg: unicode text :raises ValueError: if message can not be send/chat does not exist. :returns: the resulting :class:`deltachat.message.Message` instance
(self, text)
| 282 | return msg |
| 283 | |
| 284 | def send_text(self, text): |
| 285 | """send a text message and return the resulting Message instance. |
| 286 | |
| 287 | :param msg: unicode text |
| 288 | :raises ValueError: if message can not be send/chat does not exist. |
| 289 | :returns: the resulting :class:`deltachat.message.Message` instance |
| 290 | """ |
| 291 | msg = as_dc_charpointer(text) |
| 292 | msg_id = lib.dc_send_text_msg(self.account._dc_context, self.id, msg) |
| 293 | if msg_id == 0: |
| 294 | raise ValueError("The message could not be sent. Does the chat exist?") |
| 295 | return Message.from_db(self.account, msg_id) |
| 296 | |
| 297 | def send_file(self, path, mime_type="application/octet-stream"): |
| 298 | """send a file and return the resulting Message instance. |