Merge branch 'master' of ssh://git.mrbesen.de:2222/GamingServerGeraet/TelegramAPI
This commit is contained in:
커밋
da67d9c27a
|
@ -206,6 +206,21 @@ public class TelegramAPI implements Runnable {
|
|||
}).start();
|
||||
}
|
||||
|
||||
public void answerCallbackQuery(String callbackid, String text, boolean async) {
|
||||
if(callbackid == null)
|
||||
return;
|
||||
|
||||
if(async) {
|
||||
requestAsync("answerCallbackQuery", "callback_query_id=" + callbackid + "&text=" + text);
|
||||
} else {
|
||||
try {
|
||||
request("answerCallbackQuery", "callback_query_id=" + callbackid + "&text=" + text);
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* creates internal APIEror, when message is not modyfied!
|
||||
* @param newCaption
|
||||
|
@ -482,8 +497,9 @@ public class TelegramAPI implements Runnable {
|
|||
JSONObject cbq = json.getJSONObject("callback_query");
|
||||
TUser from = api.getUser(cbq.getJSONObject("from"));
|
||||
String data = cbq.getString("data");
|
||||
String id = cbq.getString("id");
|
||||
TMessage msg = new TMessage(cbq.getJSONObject("message"), api);
|
||||
getEventManager().callEvent(new UserCallbackEvent(from, data, msg));
|
||||
getEventManager().callEvent(new UserCallbackEvent(from, data, id, msg));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class CommandManager {
|
|||
}
|
||||
}
|
||||
//do smth. with result
|
||||
if(!result) {
|
||||
if(!result && json.getChatID() < 0) {
|
||||
TUser.sendMessage(api, json.getChatID(), api.getHelpMessage(), null, 0, true, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,13 @@ public class UserCallbackEvent extends Event {
|
|||
|
||||
private final String data;
|
||||
private final TMessage msg;
|
||||
private final String id;
|
||||
|
||||
public UserCallbackEvent(TUser u, String data, TMessage msg) {
|
||||
public UserCallbackEvent(TUser u, String data, String id, TMessage msg) {
|
||||
super(u);
|
||||
this.data = data;
|
||||
this.msg = msg;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TMessage getMsg() {
|
||||
|
@ -29,4 +31,7 @@ public class UserCallbackEvent extends Event {
|
|||
return new JSONObject(data);
|
||||
}
|
||||
|
||||
public final String getID() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
|
불러오는 중...
Reference in New Issue