From e032e59191d8ca599b166f1781c4d56f7f8a9bbb Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Thu, 25 Jun 2015 00:12:16 +0200 Subject: [PATCH 01/12] Create README.md --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4ba3cd9 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Telegram Bot Java Library +A simple to use library to create Telegram Bots in Java (Still Beta Version) + +## Webhooks vs GetUpdates +Both ways are supported (but I still didn't tested webhooks). To change between them, just go to ´BuildVars.java´ and change variable ´useWebHook´value. + +## Telegram Bot API +This library use [Telegram bot API](https://core.telegram.org/bots), you can find more information following the link. + +## Questions or Suggestions +Feel free to create issues [here](https://github.com/rubenlagus/TelegramBots/issues) as you need or contact me at our [Telegram Group](https://telegram.me/joinchat/0039114101b62e7ea87dd357a4139fe1) + +## License + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . From 4adbc98e391a9a262807d0d1fef42ca7ef2b752e Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Thu, 25 Jun 2015 00:31:13 +0200 Subject: [PATCH 02/12] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 4ba3cd9..288822b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,17 @@ A simple to use library to create Telegram Bots in Java (Still Beta Version) ## Webhooks vs GetUpdates Both ways are supported (but I still didn't tested webhooks). To change between them, just go to ´BuildVars.java´ and change variable ´useWebHook´value. +## Example bots +Open them and send them /help command to get some information about their capabilities: + +https://telegram.me/weatherbot + +https://telegram.me/directionsbot + +https://telegram.me/filesbot + +https://telegram.me/TGlanguagesbot + ## Telegram Bot API This library use [Telegram bot API](https://core.telegram.org/bots), you can find more information following the link. From b9e2f7bfbedd5c4e1278c8eb2a577f84bb3e0689 Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Thu, 25 Jun 2015 00:34:21 +0200 Subject: [PATCH 03/12] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 288822b..e78e905 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ A simple to use library to create Telegram Bots in Java (Still Beta Version) ## Webhooks vs GetUpdates -Both ways are supported (but I still didn't tested webhooks). To change between them, just go to ´BuildVars.java´ and change variable ´useWebHook´value. +Both ways are supported (but I still didn't tested webhooks). To change between them, just go to *BuildVars.java* and change variable *useWebHook* value. ## Example bots -Open them and send them /help command to get some information about their capabilities: +Open them and send them */help* command to get some information about their capabilities: https://telegram.me/weatherbot From e9e52b74826d50f05c1a3d77e54a15b02f3c32ac Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Thu, 25 Jun 2015 22:08:20 +0200 Subject: [PATCH 04/12] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e78e905..e2d8f25 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ A simple to use library to create Telegram Bots in Java (Still Beta Version) ## Webhooks vs GetUpdates Both ways are supported (but I still didn't tested webhooks). To change between them, just go to *BuildVars.java* and change variable *useWebHook* value. +I recommend using getUpdates methods. Webhooks only works over port 443 and using a certificated that is not self-signed + ## Example bots Open them and send them */help* command to get some information about their capabilities: From 2d12b4d0bab04e47fa72d08ba879eb6676aba960 Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Sun, 28 Jun 2015 12:20:12 +0200 Subject: [PATCH 05/12] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index e2d8f25..c56abee 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # Telegram Bot Java Library A simple to use library to create Telegram Bots in Java (Still Beta Version) +## Contributions +Feel free to fork this project, work on it and then make a pull request. Most of the times I will accept them if they add something valuable to the code. + +Please, **DO NOT PUSH ANY TOKEN OR API KEY**, I will never accept a pull request with that content. + ## Webhooks vs GetUpdates Both ways are supported (but I still didn't tested webhooks). To change between them, just go to *BuildVars.java* and change variable *useWebHook* value. From 25a226b5e42ef40c67f784a1f32bc207dde787e9 Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Sun, 28 Jun 2015 17:06:07 +0200 Subject: [PATCH 06/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c56abee..acdd220 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Please, **DO NOT PUSH ANY TOKEN OR API KEY**, I will never accept a pull request ## Webhooks vs GetUpdates Both ways are supported (but I still didn't tested webhooks). To change between them, just go to *BuildVars.java* and change variable *useWebHook* value. -I recommend using getUpdates methods. Webhooks only works over port 443 and using a certificated that is not self-signed +I recommend using getUpdates methods. Webhooks only works using a certificated that is not self-signed ## Example bots Open them and send them */help* command to get some information about their capabilities: From fc6af80b9d5114fae2832da5cbee03943f0742cf Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Wed, 1 Jul 2015 21:19:22 +0200 Subject: [PATCH 07/12] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index acdd220..cb5c208 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # Telegram Bot Java Library A simple to use library to create Telegram Bots in Java (Still Beta Version) +## Translations +Bots are now supporting multilanguage. If you want to add your own, feel free to translate at [transifex](https://www.transifex.com/projects/p/telegrambots/) + ## Contributions Feel free to fork this project, work on it and then make a pull request. Most of the times I will accept them if they add something valuable to the code. From 9ff444b01a20d26b433ce08c4e49f8270121c762 Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Mon, 13 Jul 2015 23:27:58 +0200 Subject: [PATCH 08/12] Create eclipse configuration.md Thanks to Rico --- eclipse configuration.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 eclipse configuration.md diff --git a/eclipse configuration.md b/eclipse configuration.md new file mode 100644 index 0000000..2c6b674 --- /dev/null +++ b/eclipse configuration.md @@ -0,0 +1,27 @@ +# How to use TelegramBots by Ruben with Eclipse + + +### Step 1: Install Maven +To get started, you need to install the Maven-Plugin for Eclipse. Click on Help > Eclipse Marketplace. After it finished loading, search for “Maven”. +Now install **“Maven (Java EE) Integration for Eclipse WTP”**. You have to restart, after the installation is completed. + +### Step 2: Download the Project +Now you need to get the project itself. +Visit [TelegramBots - github.com][1] and choose “Download Zip”, to download the zip-file. [Here] is a direct link if you are lazy. + +### Step 3: Create folder +Now let’s setup the project-folder. Go to your Eclipse-Workspace and create a folder (name it whatever you want it to be called). I just named it **“TelegramBotApi”**. Afterwards copy everything from the zip-file into that folder. + +### Step 4: Import project +To import your project into the workspace you have to go to File > Import > (Folder) Maven > Existing Maven Projects > Next. Choose the folder, you have created in Step 3. In my case: **“TelegramBotApi”**. Click on finish and let Maven import the dependencies. + +### Step 5: Setting the compliance level +In this last step you need to change the Compiler compliance level. To do this right-click on your Project (in my case **“TelegramBotApi”**) > Properties > Java Compiler. Uncheck the “Use compliance from…” if necessary and set it to 1.7 + +*Now you are done. Everything should work fine. You need to set your Bot-Token in the BotConfig.java, afterwards you can run Main.java to check.* + +**For a better intstruction sheet, visit [Google Drive]** + +[Google Drive]:https://goo.gl/5jd40w +[here]:https://github.com/rubenlagus/TelegramBots/archive/master.zip +[1]:https://github.com/rubenlagus/TelegramBots/ From 11f6c764d8f223b4160d7ea8e9f00dce0c08ca3e Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Mon, 13 Jul 2015 23:29:27 +0200 Subject: [PATCH 09/12] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index cb5c208..4df0603 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ This library use [Telegram bot API](https://core.telegram.org/bots), you can fin ## Questions or Suggestions Feel free to create issues [here](https://github.com/rubenlagus/TelegramBots/issues) as you need or contact me at our [Telegram Group](https://telegram.me/joinchat/0039114101b62e7ea87dd357a4139fe1) +## Usage with eclipse + +Follow the steps created by Rico [here](https://github.com/rubenlagus/TelegramBots/blob/master/eclipse%20configuration.md) + ## License This program is free software: you can redistribute it and/or modify From a5abea23deb638e56d222b24ce07af0b77da4b0b Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Mon, 13 Jul 2015 23:30:24 +0200 Subject: [PATCH 10/12] Update eclipse configuration.md --- eclipse configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eclipse configuration.md b/eclipse configuration.md index 2c6b674..8637ab1 100644 --- a/eclipse configuration.md +++ b/eclipse configuration.md @@ -1,4 +1,4 @@ -# How to use TelegramBots by Ruben with Eclipse +# How to use TelegramBots with Eclipse ### Step 1: Install Maven From 915d0ede64b801ef44fa069952ee707c73a8d1c0 Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Wed, 15 Jul 2015 22:30:59 +0200 Subject: [PATCH 11/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4df0603..7c4f97f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ https://telegram.me/TGlanguagesbot This library use [Telegram bot API](https://core.telegram.org/bots), you can find more information following the link. ## Questions or Suggestions -Feel free to create issues [here](https://github.com/rubenlagus/TelegramBots/issues) as you need or contact me at our [Telegram Group](https://telegram.me/joinchat/0039114101b62e7ea87dd357a4139fe1) +Feel free to create issues [here](https://github.com/rubenlagus/TelegramBots/issues) as you need ## Usage with eclipse From 23d380ff7fb1412e25ae435400797302d8e62f66 Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Mon, 20 Jul 2015 10:38:08 +0200 Subject: [PATCH 12/12] Update Document.java Fix api change --- src/main/java/org/telegram/api/Document.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/telegram/api/Document.java b/src/main/java/org/telegram/api/Document.java index 16f7735..00ecf1d 100644 --- a/src/main/java/org/telegram/api/Document.java +++ b/src/main/java/org/telegram/api/Document.java @@ -34,7 +34,12 @@ public class Document { public Document(JSONObject jsonObject) { this.fileId = jsonObject.getString(FILEID_FIELD); - this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD)); + if (jsonObject.has(THUMB_FIELD) { + this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD)); + } + else { + this.thumb = null; + } this.fileName = jsonObject.optString(FILENAME_FIELD, ""); this.mimeType = jsonObject.optString(MIMETYPE_FIELD, ""); this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);