update captions

This commit is contained in:
MrBesen 2019-02-11 17:24:21 +01:00
parent d52e8f22a4
commit 077017f590
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
1 changed files with 21 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLEncoder;
import java.util.LinkedList;
import java.util.Scanner;
@ -177,6 +178,19 @@ public class TelegramAPI implements Runnable {
}).start();
}
public void updateCaption(final String newCaption, int chatid, int msg_id, boolean async, Callback<JSONObject, ?> clb) {
try {
String q = "chat_id=" + chatid + "&message_id=" + msg_id + "&caption=" + URLEncoder.encode(newCaption, "UTF-8");
if(async) {
this.async.enque("editMessageCaption", q);
} else {
request("editMessageCaption", q);
}
} catch(IOException e) {
log.log("", e);
}
}
public void stop() {
run = false;
thread.interrupt();