Skip to content

Commit

Permalink
Fix #1275
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenlagus committed Apr 1, 2024
1 parent 0c82af2 commit c4394aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,5 +35,5 @@
@Setter
@ToString
@NoArgsConstructor
public class CallbackGame implements BotApiObject {
public class CallbackGame implements BotApiObject, Validable {
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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.
Expand All @@ -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 {
Expand All @@ -123,5 +131,11 @@ public void validate() throws TelegramApiValidationException {
if (webApp != null) {
webApp.validate();
}
if (callbackGame != null) {
callbackGame.validate();
}
if (switchInlineQueryChosenChat != null) {
switchInlineQueryChosenChat.validate();
}
}
}

0 comments on commit c4394aa

Please sign in to comment.