unit tests, insert videos
This commit is contained in:
parent
aee04b5a13
commit
225faa948d
|
@ -87,15 +87,11 @@ public class TelegramAPI implements Runnable {
|
||||||
* @param apikey
|
* @param apikey
|
||||||
*/
|
*/
|
||||||
public TelegramAPI(String apikey) {
|
public TelegramAPI(String apikey) {
|
||||||
botname = "";
|
this(apikey, "");
|
||||||
if (!apikey.matches(TOKENREGEX) ) {
|
|
||||||
throw new IllegalArgumentException("Invalid API key: " + apikey);
|
|
||||||
}
|
|
||||||
this.apikey = apikey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TelegramAPI(String apikey, String botname) {
|
public TelegramAPI(String apikey, String botname) {
|
||||||
this.botname = botname;
|
this.botname = botname != null ? botname : "";
|
||||||
|
|
||||||
if (!apikey.matches(TOKENREGEX) ) {
|
if (!apikey.matches(TOKENREGEX) ) {
|
||||||
throw new IllegalArgumentException("Invalid API key: " + apikey);
|
throw new IllegalArgumentException("Invalid API key: " + apikey);
|
||||||
|
@ -505,8 +501,10 @@ public class TelegramAPI implements Runnable {
|
||||||
} else {
|
} else {
|
||||||
e = new UserSendMessageEvent(getMsg());
|
e = new UserSendMessageEvent(getMsg());
|
||||||
//call feedback cmd first
|
//call feedback cmd first
|
||||||
if(feedbackCmd.onMsg((UserSendMessageEvent) e)) {
|
if(!disableFeedback) {
|
||||||
e = null;
|
if (feedbackCmd.onMsg((UserSendMessageEvent) e)) {
|
||||||
|
e = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getEventManager().callEvent(e);
|
getEventManager().callEvent(e);
|
||||||
|
@ -520,8 +518,12 @@ public class TelegramAPI implements Runnable {
|
||||||
TMessage msg = new TMessage(cbq.getJSONObject("message"), api);
|
TMessage msg = new TMessage(cbq.getJSONObject("message"), api);
|
||||||
UserCallbackEvent event = new UserCallbackEvent(from, data, id, msg);
|
UserCallbackEvent event = new UserCallbackEvent(from, data, id, msg);
|
||||||
|
|
||||||
if(!feedbackCmd.onCallback(event))
|
if(!disableFeedback) {
|
||||||
|
if (!feedbackCmd.onCallback(event))
|
||||||
|
getEventManager().callEvent(event);
|
||||||
|
} else {
|
||||||
getEventManager().callEvent(event);
|
getEventManager().callEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue