From 1fb3b95dca060bc6c1985538db840ed62e6be4e1 Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Mon, 27 Jul 2020 22:36:31 +0600 Subject: [PATCH] Add setters to InputMediaDocument --- src/types/input_media.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/types/input_media.rs b/src/types/input_media.rs index 4a2c9e6f..a37ebda4 100644 --- a/src/types/input_media.rs +++ b/src/types/input_media.rs @@ -378,6 +378,30 @@ pub struct InputMediaDocument { pub parse_mode: Option, } +impl InputMediaDocument { + pub fn new(media: InputFile) -> Self { + Self { media, thumb: None, caption: None, parse_mode: None } + } + + pub fn thumb(mut self, val: InputFile) -> Self { + self.thumb = Some(val); + self + } + + pub fn caption(mut self, val: S) -> Self + where + S: Into, + { + self.caption = Some(val.into()); + self + } + + pub fn parse_mode(mut self, val: ParseMode) -> Self { + self.parse_mode = Some(val); + self + } +} + impl InputMedia { pub fn media(&self) -> &InputFile { match self {