Support editing messagess sent "via bot" upon editing, an empty message is returned if successful

This commit is contained in:
Rubenlagus 2016-04-21 22:36:30 +02:00
parent a601e983ec
commit 6431adfe87
3 changed files with 18 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONException;
import org.json.JSONObject;
import org.telegram.telegrambots.Constants;
import org.telegram.telegrambots.api.methods.BotApiMethod;
@ -119,7 +120,11 @@ public class EditMessageCaption extends BotApiMethod<Message> {
@Override
public Message deserializeResponse(JSONObject answer) {
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
try {
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
} catch (JSONException e) {
return new Message();
}
}
return null;
}

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONException;
import org.json.JSONObject;
import org.telegram.telegrambots.Constants;
import org.telegram.telegrambots.api.methods.BotApiMethod;
@ -105,7 +106,11 @@ public class EditMessageReplyMarkup extends BotApiMethod<Message> {
@Override
public Message deserializeResponse(JSONObject answer) {
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
try {
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
} catch (JSONException e) {
return new Message();
}
}
return null;
}

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONException;
import org.json.JSONObject;
import org.telegram.telegrambots.Constants;
import org.telegram.telegrambots.api.methods.BotApiMethod;
@ -163,7 +164,11 @@ public class EditMessageText extends BotApiMethod<Message> {
@Override
public Message deserializeResponse(JSONObject answer) {
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
try {
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
} catch (JSONException e) {
return new Message();
}
}
return null;
}