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
15
use crate::Client;
use crate::errors::Result;
use crate::raw::functions;
use crate::types::{PeerRef, TranscribedAudio};

impl Client {
    /// Transcribes the audio of a voice or video note message to text.
    ///
    /// While `is_pending` is set, the final text arrives later as a raw `UpdateTranscribedAudio`.
    pub async fn transcribe_audio(&self, chat_id: impl Into<PeerRef>, message_id: i32) -> Result<TranscribedAudio> {
        let peer = self.resolve_peer(chat_id).await?;
        let transcribed = self.invoke(&functions::messages::TranscribeAudio { peer, msg_id: message_id }).await?;
        Ok(TranscribedAudio::parse(transcribed))
    }
}