unit tests, insert videos

This commit is contained in:
MrBesen 2020-05-05 17:18:48 +02:00 committed by mrbesen
parent aee04b5a13
commit 225faa948d
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
1 changed files with 11 additions and 9 deletions

View File

@ -87,15 +87,11 @@ public class TelegramAPI implements Runnable {
* @param apikey
*/
public TelegramAPI(String apikey) {
botname = "";
if (!apikey.matches(TOKENREGEX) ) {
throw new IllegalArgumentException("Invalid API key: " + apikey);
}
this.apikey = apikey;
this(apikey, "");
}
public TelegramAPI(String apikey, String botname) {
this.botname = botname;
this.botname = botname != null ? botname : "";
if (!apikey.matches(TOKENREGEX) ) {
throw new IllegalArgumentException("Invalid API key: " + apikey);
@ -505,8 +501,10 @@ public class TelegramAPI implements Runnable {
} else {
e = new UserSendMessageEvent(getMsg());
//call feedback cmd first
if(feedbackCmd.onMsg((UserSendMessageEvent) e)) {
e = null;
if(!disableFeedback) {
if (feedbackCmd.onMsg((UserSendMessageEvent) e)) {
e = null;
}
}
}
getEventManager().callEvent(e);
@ -520,8 +518,12 @@ public class TelegramAPI implements Runnable {
TMessage msg = new TMessage(cbq.getJSONObject("message"), api);
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);
}
}
}