From 3e0f8ab68651eec73e4f74efff7d810999ebcbe8 Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Tue, 28 Jul 2020 02:14:58 +0600 Subject: [PATCH] Add setters to ForwardChannel --- src/types/message.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/types/message.rs b/src/types/message.rs index d12c43f5..9a3eaa95 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -466,6 +466,35 @@ pub struct ForwardChannel { pub signature: Option, } +impl ForwardChannel { + pub fn new(date: i32, chat: Chat, message_id: i32) -> Self { + Self { date, chat, message_id, signature: None } + } + + pub fn date(mut self, val: i32) -> Self { + self.date = val; + self + } + + pub fn chat(mut self, val: Chat) -> Self { + self.chat = val; + self + } + + pub fn message_id(mut self, val: i32) -> Self { + self.message_id = val; + self + } + + pub fn signature(mut self, val: S) -> Self + where + S: Into, + { + self.signature = Some(val.into()); + self + } +} + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct ForwardNonChannel {