Skip to content

Commit

Permalink
Merge pull request #1 from EXH3Y/development
Browse files Browse the repository at this point in the history
0.0.2 release
  • Loading branch information
EXH3Y committed Dec 7, 2015
2 parents 52950a6 + 31edbd5 commit 348f7d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion telebot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>exh3y</groupId>
<artifactId>telebot</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>
<packaging>jar</packaging>

<name>TeleBot</name>
Expand Down
5 changes: 3 additions & 2 deletions telebot/src/main/java/exh3y/telebot/TeleBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,17 @@ public void run() {

// Iterate over the messages in the last update
JSONObject message = jsonResponse.getJSONObject(i).getJSONObject("message");
int chatId = message.getJSONObject("chat").getInt("id");

if (message.has("text")) {

String command[] = message.getString("text").split(" ");

if (actionConnector.containsKey(command[0])) {
TelegramActionHandler action = actionConnector.get(command[0]);
action.onCommandReceive(message);
action.onCommandReceive(chatId, message);
} else if (defaultAction != null) {
defaultAction.onCommandReceive(message);
defaultAction.onCommandReceive(chatId, message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public interface TelegramActionHandler {
* The 'message' part of the response object
* @since 0.0.1
*/
public abstract void onCommandReceive(JSONObject responseObject);
public void onCommandReceive(int chatId, JSONObject responseObject);

}

0 comments on commit 348f7d6

Please sign in to comment.