vaegram 0.3.0

Telegram MTProto client library for users and bots
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::Client;
use crate::errors::Result;
use crate::raw::{base, functions, types};
use crate::types::PeerRef;

impl Client {
    /// Flags a chat as unread, without changing which messages are read.
    pub async fn mark_chat_unread(&self, chat_id: impl Into<PeerRef>) -> Result<()> {
        let peer = types::InputDialogPeer { peer: self.resolve_peer(chat_id).await? };
        let peer = base::InputDialogPeer::InputDialogPeer(Box::new(peer));
        self.invoke(&functions::messages::MarkDialogUnread { unread: true, parent_peer: None, peer }).await?;
        Ok(())
    }
}