Support editing messagess sent "via bot" upon editing, an empty message is returned if successful
This commit is contained in:
parent
a601e983ec
commit
6431adfe87
@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
|||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.telegrambots.Constants;
|
import org.telegram.telegrambots.Constants;
|
||||||
import org.telegram.telegrambots.api.methods.BotApiMethod;
|
import org.telegram.telegrambots.api.methods.BotApiMethod;
|
||||||
@ -119,7 +120,11 @@ public class EditMessageCaption extends BotApiMethod<Message> {
|
|||||||
@Override
|
@Override
|
||||||
public Message deserializeResponse(JSONObject answer) {
|
public Message deserializeResponse(JSONObject answer) {
|
||||||
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
|
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
|
||||||
|
try {
|
||||||
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
|
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
|
||||||
|
} catch (JSONException e) {
|
||||||
|
return new Message();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
|||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.telegrambots.Constants;
|
import org.telegram.telegrambots.Constants;
|
||||||
import org.telegram.telegrambots.api.methods.BotApiMethod;
|
import org.telegram.telegrambots.api.methods.BotApiMethod;
|
||||||
@ -105,7 +106,11 @@ public class EditMessageReplyMarkup extends BotApiMethod<Message> {
|
|||||||
@Override
|
@Override
|
||||||
public Message deserializeResponse(JSONObject answer) {
|
public Message deserializeResponse(JSONObject answer) {
|
||||||
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
|
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
|
||||||
|
try {
|
||||||
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
|
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
|
||||||
|
} catch (JSONException e) {
|
||||||
|
return new Message();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
|||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.telegrambots.Constants;
|
import org.telegram.telegrambots.Constants;
|
||||||
import org.telegram.telegrambots.api.methods.BotApiMethod;
|
import org.telegram.telegrambots.api.methods.BotApiMethod;
|
||||||
@ -163,7 +164,11 @@ public class EditMessageText extends BotApiMethod<Message> {
|
|||||||
@Override
|
@Override
|
||||||
public Message deserializeResponse(JSONObject answer) {
|
public Message deserializeResponse(JSONObject answer) {
|
||||||
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
|
if (answer.getBoolean(Constants.RESPONSEFIELDOK)) {
|
||||||
|
try {
|
||||||
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
|
return new Message(answer.getJSONObject(Constants.RESPONSEFIELDRESULT));
|
||||||
|
} catch (JSONException e) {
|
||||||
|
return new Message();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user