Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refetch message and mutate it #293

Open
the-ho-mang opened this issue Dec 1, 2024 · 2 comments
Open

Refetch message and mutate it #293

the-ho-mang opened this issue Dec 1, 2024 · 2 comments

Comments

@the-ho-mang
Copy link

    /// 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 ?

@Lonami
Copy link
Owner

Lonami commented Dec 1, 2024

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

@goni098
Copy link

goni098 commented Dec 1, 2024

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

yeah, returning the new mesage here is good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants