Merge branch 'Clevero-correctly-process-returned-message-at-sendAudio' into dev
This commit is contained in:
commit
f9ef9cb117
@ -527,11 +527,17 @@ public abstract class AbsSender {
|
||||
}
|
||||
|
||||
JSONObject jsonObject = new JSONObject(responseContent);
|
||||
if (!jsonObject.getBoolean("ok")) {
|
||||
throw new TelegramApiException("Error at sendAudio", jsonObject.getString("description"));
|
||||
|
||||
/* if we got not an "ok" with false, we have a response like that
|
||||
*
|
||||
* {"description":"[Error]: Bad Request: chat not found","error_code":400,"ok":false}
|
||||
*/
|
||||
if(!jsonObject.getBoolean("ok")){
|
||||
throw new TelegramApiException("Error at sendAudio", jsonObject.getString("description"));
|
||||
}
|
||||
|
||||
return new Message(jsonObject);
|
||||
// and if not, we can expect a "result" section. and out of this can a new Message object be built
|
||||
return new Message(jsonObject.getJSONObject("result"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user