grammers icon indicating copy to clipboard operation
grammers copied to clipboard

Refetch message and mutate it

Open the-ho-mang opened this issue 1 year ago • 2 comments

    /// Refetch this message, mutating all of its properties in-place.
    ///
    /// No changes will be made to the message if it fails to be fetched.
    ///
    /// Shorthand for `Client::get_messages_by_id`.
    pub async fn refetch(&self) -> Result<(), InvocationError> {
        // When fetching a single message, if it fails, Telegram should respond with RPC error.
        // If it succeeds we will have the single message present which we can unwrap.
        self.client
            .get_messages_by_id(&self.chat(), &[self.raw.id])
            .await?
            .pop()
            .unwrap()
            .unwrap();
        todo!("actually mutate self after get_messages_by_id returns `Message`")
    }

Why hasn't the message mutation been done here ?

the-ho-mang avatar Dec 01 '24 03:12 the-ho-mang

It hasn't been implemented fully. Maybe returning the Message is better / more obvious.

Lonami avatar Dec 01 '24 07:12 Lonami

It hasn't been implemented fully. Maybe returning the Message is better / more obvious.

yeah, returning the new mesage here is good.

goni098 avatar Dec 01 '24 09:12 goni098