|
|
|
@ -563,7 +563,6 @@ public class TelegramAPI implements Runnable {
|
|
|
|
|
protected class TelegramAPIUpdate { |
|
|
|
|
protected int update_id = 0; |
|
|
|
|
private TMessage msg = null; |
|
|
|
|
private boolean isCommand = false; |
|
|
|
|
|
|
|
|
|
protected TelegramAPIUpdate(JSONObject json, TelegramAPI api) { |
|
|
|
|
update_id = json.getInt("update_id"); |
|
|
|
@ -573,9 +572,8 @@ public class TelegramAPI implements Runnable {
|
|
|
|
|
|
|
|
|
|
String text = msg.getText(); |
|
|
|
|
if(text != null) { |
|
|
|
|
if(text.matches("^\\/(\\w*)(@(\\w*))?")) { //is a command
|
|
|
|
|
if(text.matches("^\\/(\\w+)(@(\\w+))?(\\s.*)?")) { //is a command
|
|
|
|
|
text = text.substring(1);//remove '/'
|
|
|
|
|
isCommand = true; |
|
|
|
|
if(text.contains("@")) {//check name
|
|
|
|
|
int at = text.indexOf('@'); |
|
|
|
|
int end = text.indexOf(' ', at+1); |
|
|
|
@ -642,22 +640,6 @@ public class TelegramAPI implements Runnable {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected int getUpdate_id() { |
|
|
|
|
return update_id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected TMessage getMsg() { |
|
|
|
|
return msg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected TUser getUser() { |
|
|
|
|
return msg.getFrom(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected boolean isCommand() { |
|
|
|
|
return isCommand; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public enum JSONObjectType { |
|
|
|
|