From c4394aaa1704e3691b54710c6dd238c74e1f34e1 Mon Sep 17 00:00:00 2001 From: ruben Date: Mon, 1 Apr 2024 13:40:19 +0100 Subject: [PATCH] Fix #1275 --- .../meta/api/objects/games/CallbackGame.java | 3 ++- .../buttons/InlineKeyboardButton.java | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/games/CallbackGame.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/games/CallbackGame.java index 329c2554b..ad549cc51 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/games/CallbackGame.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/games/CallbackGame.java @@ -23,6 +23,7 @@ import lombok.Setter; import lombok.ToString; import org.telegram.telegrambots.meta.api.interfaces.BotApiObject; +import org.telegram.telegrambots.meta.api.interfaces.Validable; /** * @author Ruben Bermudez @@ -34,5 +35,5 @@ @Setter @ToString @NoArgsConstructor -public class CallbackGame implements BotApiObject { +public class CallbackGame implements BotApiObject, Validable { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/replykeyboard/buttons/InlineKeyboardButton.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/replykeyboard/buttons/InlineKeyboardButton.java index 6b2738990..ba94471ed 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/replykeyboard/buttons/InlineKeyboardButton.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/replykeyboard/buttons/InlineKeyboardButton.java @@ -43,6 +43,7 @@ public class InlineKeyboardButton implements Validable, BotApiObject { private static final String CALLBACK_GAME_FIELD = "callback_game"; private static final String SWITCH_INLINE_QUERY_FIELD = "switch_inline_query"; private static final String SWITCH_INLINE_QUERY_CURRENT_CHAT_FIELD = "switch_inline_query_current_chat"; + private static final String SWITCH_INLINE_QUERY_CHOSEN_CHAT_FIELD = "switch_inline_query_chosen_chat"; private static final String PAY_FIELD = "pay"; private static final String LOGIN_URL_FIELD = "login_url"; private static final String WEBAPP_FIELD = "web_app"; @@ -102,7 +103,6 @@ public class InlineKeyboardButton implements Validable, BotApiObject { */ @JsonProperty(LOGIN_URL_FIELD) private LoginUrl loginUrl; - /** * Optional. * Description of the web app that will be launched when the user presses the button. @@ -111,6 +111,14 @@ public class InlineKeyboardButton implements Validable, BotApiObject { */ @JsonProperty(WEBAPP_FIELD) private WebAppInfo webApp; + /** + * Optional. + * If set, pressing the button will prompt the user to select one of their chats of the specified type, + * open that chat and insert the bot's username and the specified inline query in the input field + */ + @JsonProperty(SWITCH_INLINE_QUERY_CHOSEN_CHAT_FIELD) + private SwitchInlineQueryChosenChat switchInlineQueryChosenChat; + @Override public void validate() throws TelegramApiValidationException { @@ -123,5 +131,11 @@ public void validate() throws TelegramApiValidationException { if (webApp != null) { webApp.validate(); } + if (callbackGame != null) { + callbackGame.validate(); + } + if (switchInlineQueryChosenChat != null) { + switchInlineQueryChosenChat.validate(); + } } }