Add setters to InputMediaAudio
@@ -201,6 +201,58 @@ pub struct InputMediaAnimation {
pub duration: Option<u16>,
}
+impl InputMediaAnimation {
+ pub fn new(media: InputFile) -> Self {
+ Self {
+ media,
+ thumb: None,
+ caption: None,
+ parse_mode: None,
+ width: None,
+ height: None,
+ duration: None,
+ }
+ }
+
+ pub fn media(mut self, val: InputFile) -> Self {
+ self.media = val;
+ self
+ }
+
+ pub fn thumb(mut self, val: InputFile) -> Self {
+ self.thumb = Some(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
+ }
+
+ pub fn width(mut self, val: u16) -> Self {
+ self.width = Some(val);
+ self
+ }
+
+ pub fn height(mut self, val: u16) -> Self {
+ self.height = Some(val);
+ self
+ }
+
+ pub fn duration(mut self, val: u16) -> Self {
+ self.duration = Some(val);
+ self
+ }
+}
+
/// Represents an audio file to be treated as music to be sent.
///
/// [The official docs](https://core.telegram.org/bots/api#inputmediaaudio).
@@ -239,6 +291,64 @@ pub struct InputMediaAudio {
pub title: Option<String>,
}
+impl InputMediaAudio {
+ pub fn new(media: InputFile) -> Self {
+ Self {
+ media,
+ thumb: None,
+ caption: None,
+ parse_mode: None,
+ performer: None,
+ title: None,
+ duration: None,
+ }
+ }
+
+ pub fn media(mut self, val: InputFile) -> Self {
+ self.media = val;
+ self
+ }
+
+ pub fn thumb(mut self, val: InputFile) -> Self {
+ self.thumb = Some(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: String) -> Self {
+ self.parse_mode = Some(val);
+ self
+ }
+
+ pub fn duration(mut self, val: u16) -> Self {
+ self.duration = Some(val);
+ self
+ }
+
+ pub fn performer<S>(mut self, val: S) -> Self
+ where
+ S: Into<String>,
+ {
+ self.performer = Some(val.into());
+ self
+ }
+
+ pub fn title<S>(mut self, val: S) -> Self
+ where
+ S: Into<String>,
+ {
+ self.title = Some(val.into());
+ self
+ }
+}
+
/// Represents a general file to be sent.
///
/// [The official docs](https://core.telegram.org/bots/api#inputmediadocument).
