diff --git a/pom.xml b/pom.xml
index 0fb5e85e..10dce16c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
jar
org.telegram
telegrambots
- 2.4.0.BETA3-SNAPSHOT
+ 2.4.0.BETA4-SNAPSHOT
Telegram Bots
https://github.com/rubenlagus/TelegramBots
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/games/CallbackGame.java b/src/main/java/org/telegram/telegrambots/api/objects/games/CallbackGame.java
index 7eb90d97..95b4e7eb 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/games/CallbackGame.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/games/CallbackGame.java
@@ -17,80 +17,42 @@
package org.telegram.telegrambots.api.objects.games;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
-import org.telegram.telegrambots.api.interfaces.Validable;
-import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 2.4
- * @brief This object contains information about a game that will be returned as a response to a callback query.
+ * @brief This object contains information about a game that will be returned as a response to a
+ * callback query. It has no fields, use BotFather to setup your game,
+ * its short name will actt as an identifier.
* @date 16 of September of 2016
*/
-public class CallbackGame implements IBotApiObject, Validable {
- private static final String TITLE_FIELD = "title";
- private static final String ID_FIELD = "game_id";
- private static final String START_PARAMETER_FIELD = "start_parameter";
-
- @JsonProperty(TITLE_FIELD)
- private String title; ///< Game title, aim at 128 characters or lower
- @JsonProperty(ID_FIELD)
- private Integer gameId; ///< Game identifier
- @JsonProperty(START_PARAMETER_FIELD)
- private String startParameter; ///< Start parameter for the bot URL when users share the game with others. See deep linking for more info.
-
- public CallbackGame() {
- super();
- }
+public class CallbackGame implements IBotApiObject {
+ private final JSONObject content;
public CallbackGame(JSONObject object) {
super();
- title = object.getString(TITLE_FIELD);
- gameId = object.getInt(ID_FIELD);
- startParameter = object.getString(START_PARAMETER_FIELD);
+ content = object;
}
- public String getTitle() {
- return title;
+ public JSONObject getContent() {
+ return content;
}
- public Integer getGameId() {
- return gameId;
- }
-
- public String getStartParameter() {
- return startParameter;
- }
-
- @Override
- public void validate() throws TelegramApiValidationException {
- if (title == null || title.isEmpty()) {
- throw new TelegramApiValidationException("Title parameter can't be empty", this);
- }
- if (gameId == null) {
- throw new TelegramApiValidationException("Id parameter can't be empty", this);
- }
- if (startParameter == null || startParameter.isEmpty()) {
- throw new TelegramApiValidationException("StartParameter parameter can't be empty", this);
- }
+ public String getContentText() {
+ return content.toString();
}
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
- gen.writeStartObject();
- gen.writeStringField(TITLE_FIELD, title);
- gen.writeNumberField(ID_FIELD, gameId);
- gen.writeStringField(START_PARAMETER_FIELD, startParameter);
- gen.writeEndObject();
- gen.flush();
+ gen.writeObject(content);
}
@Override
@@ -101,9 +63,7 @@ public class CallbackGame implements IBotApiObject, Validable {
@Override
public String toString() {
return "CallbackGame{" +
- "title='" + title + '\'' +
- ", gameId=" + gameId +
- ", startParameter='" + startParameter + '\'' +
+ "content=" + content +
'}';
}
}
diff --git a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/InlineKeyboardButton.java b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/InlineKeyboardButton.java
index 6a044534..0931cc35 100644
--- a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/InlineKeyboardButton.java
+++ b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/InlineKeyboardButton.java
@@ -147,9 +147,6 @@ public class InlineKeyboardButton implements IBotApiObject, IToJson, Validable {
if (text == null || text.isEmpty()) {
throw new TelegramApiValidationException("Text parameter can't be empty", this);
}
- if (callbackGame != null) {
- callbackGame.validate();
- }
}
@Override