Get draft for a chat, if any.
(&self, account_id: u32, chat_id: u32)
| 2514 | |
| 2515 | /// Get draft for a chat, if any. |
| 2516 | async fn get_draft(&self, account_id: u32, chat_id: u32) -> Result<Option<MessageObject>> { |
| 2517 | let ctx = self.get_context(account_id).await?; |
| 2518 | if let Some(draft) = ChatId::new(chat_id).get_draft(&ctx).await? { |
| 2519 | Ok(MessageObject::from_msg_id(&ctx, draft.get_id()).await?) |
| 2520 | } else { |
| 2521 | Ok(None) |
| 2522 | } |
| 2523 | } |
| 2524 | |
| 2525 | // --------------------------------------------- |
| 2526 | // misc prototyping functions |
no test coverage detected