From 22a370e4c8a5374513231256bdefdc2ea75d44e1 Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Mon, 27 Jul 2020 20:10:14 +0600 Subject: [PATCH] Add setters to InlineQueryResultGame --- src/types/inline_query_result_game.rs | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/types/inline_query_result_game.rs b/src/types/inline_query_result_game.rs index 9f86b0f9..c795547c 100644 --- a/src/types/inline_query_result_game.rs +++ b/src/types/inline_query_result_game.rs @@ -22,3 +22,34 @@ pub struct InlineQueryResultGame { /// [Inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating pub reply_markup: Option, } + +impl InlineQueryResultGame { + pub fn new(id: S1, game_short_name: S2) -> Self + where + S1: Into, + S2: Into, + { + Self { id: id.into(), game_short_name: game_short_name.into(), reply_markup: None } + } + + pub fn id(mut self, val: S) -> Self + where + S: Into, + { + self.id = val.into(); + self + } + + pub fn game_short_name(mut self, val: S) -> Self + where + S: Into, + { + self.game_short_name = val.into(); + self + } + + pub fn reply_markup(mut self, val: InlineKeyboardMarkup) -> Self { + self.reply_markup = Some(val); + self + } +}