diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..e604f04 --- /dev/null +++ b/.classpath @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/.project b/.project new file mode 100644 index 0000000..0b3f4aa --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + JTelegramBot + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/JTelegramBot Core/src/io/fouad/jtb/core/JTelegramBot.java b/JTelegramBot Core/src/io/fouad/jtb/core/JTelegramBot.java index 1636ee3..e22a1bd 100644 --- a/JTelegramBot Core/src/io/fouad/jtb/core/JTelegramBot.java +++ b/JTelegramBot Core/src/io/fouad/jtb/core/JTelegramBot.java @@ -881,7 +881,7 @@ public BooleanOrMessageResult editMessageText(ChatIdentifier targetChatIdentifie if(inlineKeyboardMarkup != null) formFields.add(new NameValueParameter("reply_markup", JsonUtils.toJson(inlineKeyboardMarkup))); HttpResponse response = HttpClient.sendHttpPost(API_URL_PREFIX + apiToken + "/editMessageText", formFields); - TelegramResult telegramResult = JsonUtils.toJavaObject(response.getResponseBody(), new TypeReference>(){}); + TelegramResult telegramResult = JsonUtils.toJavaObject(response.getResponseBody(), new TypeReference>(){}); if(!telegramResult.isOk()) throw new NegativeResponseException(response.getHttpStatusCode(), telegramResult); diff --git a/JTelegramBot Core/src/io/fouad/jtb/core/beans/CallbackQuery.java b/JTelegramBot Core/src/io/fouad/jtb/core/beans/CallbackQuery.java index 102e9ba..ff4d13d 100644 --- a/JTelegramBot Core/src/io/fouad/jtb/core/beans/CallbackQuery.java +++ b/JTelegramBot Core/src/io/fouad/jtb/core/beans/CallbackQuery.java @@ -57,6 +57,8 @@ public class CallbackQuery @JsonProperty("message") private Message message; + @JsonProperty("chat_instance") + private String chat_instance; /** * Optional. Identifier of the message sent via the bot in * inline mode, that originated the query. @@ -73,13 +75,14 @@ public class CallbackQuery public CallbackQuery(){} - public CallbackQuery(String id, User from, Message message, String inline_message_id, String data) + public CallbackQuery(String id, User from, Message message, String inline_message_id, String data, String chat_instance) { this.id = id; this.from = from; this.message = message; this.inline_message_id = inline_message_id; this.data = data; + this.chat_instance=chat_instance; } public String getId(){return id;} @@ -87,44 +90,69 @@ public CallbackQuery(String id, User from, Message message, String inline_messag public Message getMessage(){return message;} public String getInline_message_id(){return inline_message_id;} public String getData(){return data;} - + public String getchat_instance(){return chat_instance;} + @Override - public boolean equals(Object o) - { - if(this == o) return true; - if(!(o instanceof CallbackQuery)) return false; - - CallbackQuery that = (CallbackQuery) o; - - if(id != null ? !id.equals(that.id) : that.id != null) return false; - if(from != null ? !from.equals(that.from) : that.from != null) return false; - if(message != null ? !message.equals(that.message) : that.message != null) return false; - if(inline_message_id != null ? !inline_message_id.equals(that.inline_message_id) - : that.inline_message_id != null) return false; - return data != null ? data.equals(that.data) : that.data == null; - + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((chat_instance == null) ? 0 : chat_instance.hashCode()); + result = prime * result + ((data == null) ? 0 : data.hashCode()); + result = prime * result + ((from == null) ? 0 : from.hashCode()); + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((inline_message_id == null) ? 0 : inline_message_id.hashCode()); + result = prime * result + ((message == null) ? 0 : message.hashCode()); + return result; } - + @Override - public int hashCode() - { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (from != null ? from.hashCode() : 0); - result = 31 * result + (message != null ? message.hashCode() : 0); - result = 31 * result + (inline_message_id != null ? inline_message_id.hashCode() : 0); - result = 31 * result + (data != null ? data.hashCode() : 0); - return result; + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CallbackQuery other = (CallbackQuery) obj; + if (chat_instance == null) { + if (other.chat_instance != null) + return false; + } else if (!chat_instance.equals(other.chat_instance)) + return false; + if (data == null) { + if (other.data != null) + return false; + } else if (!data.equals(other.data)) + return false; + if (from == null) { + if (other.from != null) + return false; + } else if (!from.equals(other.from)) + return false; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + if (inline_message_id == null) { + if (other.inline_message_id != null) + return false; + } else if (!inline_message_id.equals(other.inline_message_id)) + return false; + if (message == null) { + if (other.message != null) + return false; + } else if (!message.equals(other.message)) + return false; + return true; } - + @Override - public String toString() - { - return "CallbackQuery{" + - "id='" + id + '\'' + - ", from=" + from + - ", message=" + message + - ", inline_message_id='" + inline_message_id + '\'' + - ", data='" + data + '\'' + - '}'; + public String toString() { + return "CallbackQuery [id=" + id + ", from=" + from + ", message=" + message + ", chat_instance=" + chat_instance + + ", inline_message_id=" + inline_message_id + ", data=" + data + "]"; } + + + } \ No newline at end of file diff --git a/jars/JTelegramBot-Core-v1.1.jar b/jars/JTelegramBot-Core-v1.1.jar index 132ce7d..7838b48 100644 Binary files a/jars/JTelegramBot-Core-v1.1.jar and b/jars/JTelegramBot-Core-v1.1.jar differ