telers/types/
inline_query_result_game.rs1use super::InlineKeyboardMarkup;
2
3use serde::{Deserialize, Serialize};
4use serde_with::skip_serializing_none;
5
6#[skip_serializing_none]
12#[derive(Debug, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
13pub struct InlineQueryResultGame {
14 pub id: String,
16 pub game_short_name: String,
18 pub reply_markup: Option<InlineKeyboardMarkup>,
20}
21
22impl InlineQueryResultGame {
23 #[must_use]
24 pub fn new(id: impl Into<String>, game_short_name: impl Into<String>) -> Self {
25 Self {
26 id: id.into(),
27 game_short_name: game_short_name.into(),
28 reply_markup: None,
29 }
30 }
31
32 #[must_use]
33 pub fn id(self, val: impl Into<String>) -> Self {
34 Self {
35 id: val.into(),
36 ..self
37 }
38 }
39
40 #[must_use]
41 pub fn game_short_name(self, val: impl Into<String>) -> Self {
42 Self {
43 game_short_name: val.into(),
44 ..self
45 }
46 }
47
48 #[must_use]
49 pub fn reply_markup(self, val: impl Into<InlineKeyboardMarkup>) -> Self {
50 Self {
51 reply_markup: Some(val.into()),
52 ..self
53 }
54 }
55}
56
57impl InlineQueryResultGame {
58 #[must_use]
59 pub fn reply_markup_option(self, val: Option<impl Into<InlineKeyboardMarkup>>) -> Self {
60 Self {
61 reply_markup: val.map(Into::into),
62 ..self
63 }
64 }
65}