Add setters to InputMediaPhoto

This commit is contained in:
Temirkhan Myrzamadi 2020-07-27 22:00:43 +06:00
parent 5044cf542b
commit 9e547766ad

View file

@ -38,6 +38,30 @@ pub struct InputMediaPhoto {
pub parse_mode: Option<ParseMode>,
}
impl InputMediaPhoto {
pub fn new(media: InputFile) -> Self {
Self { media, caption: None, parse_mode: None }
}
pub fn media(mut self, val: InputFile) -> Self {
self.media = val;
self
}
pub fn caption<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.caption = Some(val.into());
self
}
pub fn parse_mode(mut self, val: ParseMode) -> Self {
self.parse_mode = Some(val);
self
}
}
/// Represents a video to be sent.
///
/// [The official docs](https://core.telegram.org/bots/api#inputmediavideo).