update captions
This commit is contained in:
parent
d52e8f22a4
commit
077017f590
|
@ -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();
|
||||
|
@ -201,8 +215,8 @@ public class TelegramAPI implements Runnable {
|
|||
fetchedUpdates++;
|
||||
try {
|
||||
int wait = (int) (updateInterval - (System.currentTimeMillis() - runstart));
|
||||
if(wait > 0)
|
||||
Thread.sleep(wait);
|
||||
if(wait > 0)
|
||||
Thread.sleep(wait);
|
||||
} catch (InterruptedException e) {
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue