Closed er-azh closed 1 month ago
Hmmm, what about adding something like this and then adding into_document
and into_photo
to Uploaded
instead?
pub fn media<T: Into<tl::enums::InputMedia>>(mut self, media: T) -> Self {
self.media = Some(media.into());
self
}
The issue with using a generic parameter for the current document
and photo
methods is that I can't think of a way to differentiate between the media types (eg. InputMediaPhoto
and InputMediaDocument
) while accepting both uploaded and forwarded variants of InputMedia
(eg. InputMediaPhoto
and InputMediaUploadedPhoto
) without adding at least one unnecessary wrapper type.
I was thinking of two traits, IntoInputPhoto
and IntoInputDocument
, both implemented for Uploaded
, but only one for the raw types.
I've updated everything based on the telegram discussion.
Adds two new methods to
InputMessage
,photo_id
anddocument_id
. These new methods allow the user to include media in their messages usingInputPhoto
andInputDocument
without having to copy the media from a message or re-uploading.