From de6884be2523eca113fc74fce98fbbdd1415dda1 Mon Sep 17 00:00:00 2001 From: Rubenlagus Date: Fri, 27 May 2016 15:23:32 +0200 Subject: [PATCH 1/6] 1. Update pom file --- ...benlagus_TelegramBots_v2_3_3_2_alpha_2.xml | 13 ++ BotAPi.iml | 2 +- pom.xml | 120 ++++++++++++------ 3 files changed, 94 insertions(+), 41 deletions(-) create mode 100644 .idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2_alpha_2.xml diff --git a/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2_alpha_2.xml b/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2_alpha_2.xml new file mode 100644 index 0000000..37ba0be --- /dev/null +++ b/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2_alpha_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/BotAPi.iml b/BotAPi.iml index a9b350a..f5dc32a 100644 --- a/BotAPi.iml +++ b/BotAPi.iml @@ -11,7 +11,7 @@ - + diff --git a/pom.xml b/pom.xml index f9ccb4e..8037e8a 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ UTF-8 UTF-8 4.5.2 - v2.3.3.1 + v2.3.3.2-alpha-2 20160212 5.1.39 @@ -74,44 +74,87 @@ ${project.artifactId}-${project.version} ${project.build.directory}/test-classes ${project.basedir}/src/main/java + + + maven-clean-plugin + 3.0.0 + + + clean-project + clean + + clean + + + + + + maven-assembly-plugin + 2.6 + + + + org.telegram.Main + + + + jar-with-dependencies + + + + + make-assembly + package + + single + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.0 + + + attach-sources + verify + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + true + org.telegram.Main + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + + attach-javadocs + site + + javadoc-no-fork + + + + + - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - - true - lib/ - org.telegram.Main - - - - - - maven-assembly-plugin - - - - org.telegram.Main - - - - jar-with-dependencies - - - - - make-assembly - package - - single - - - - org.apache.maven.plugins maven-dependency-plugin @@ -132,9 +175,6 @@ - - maven-clean-plugin - org.apache.maven.plugins maven-compiler-plugin From 34bcebcc4b8f47f3a35f660c18a5314311591c04 Mon Sep 17 00:00:00 2001 From: dapoldi Date: Tue, 31 May 2016 06:34:44 -0700 Subject: [PATCH 2/6] Webhook example --- BotAPi.iml | 2 +- pom.xml | 2 +- src/main/java/org/telegram/BotConfig.java | 2 + src/main/java/org/telegram/BuildVars.java | 12 +++-- src/main/java/org/telegram/Main.java | 42 +++++++++++++---- .../webHookExampleHandlers.java | 47 +++++++++++++++++++ 6 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java diff --git a/BotAPi.iml b/BotAPi.iml index f5dc32a..827dbc7 100644 --- a/BotAPi.iml +++ b/BotAPi.iml @@ -11,7 +11,7 @@ - + diff --git a/pom.xml b/pom.xml index 8037e8a..06f40ed 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ UTF-8 UTF-8 4.5.2 - v2.3.3.2-alpha-2 + v2.3.3.2 20160212 5.1.39 diff --git a/src/main/java/org/telegram/BotConfig.java b/src/main/java/org/telegram/BotConfig.java index 9f56e8e..353e876 100644 --- a/src/main/java/org/telegram/BotConfig.java +++ b/src/main/java/org/telegram/BotConfig.java @@ -19,4 +19,6 @@ public class BotConfig { public static final String USERNAMECHANNEL = "channelupdatesbot"; public static final String TOKENRAE = ""; public static final String USERNAMERAE = "raebot"; + public static final String TOKENWEBHOOK = ""; + public static final String USERNAMEWEBHOOK = "webhooksamplebot"; } diff --git a/src/main/java/org/telegram/BuildVars.java b/src/main/java/org/telegram/BuildVars.java index 9a973a0..3fc237f 100644 --- a/src/main/java/org/telegram/BuildVars.java +++ b/src/main/java/org/telegram/BuildVars.java @@ -6,14 +6,16 @@ package org.telegram; * @brief Custom build vars FILL EVERYTHING CORRECTLY * @date 20 of June of 2015 */ + public class BuildVars { public static final Boolean debug = true; - public static final Boolean useWebHook = true; + public static final Boolean useWebHook = false; public static final int PORT = 8443; - public static final String EXTERNALWEBHOOKURL = "your-external-url:" + PORT; - public static final String INTERNALWEBHOOKURL = "your-internal-url:" + PORT; - public static final String pathToCertificatePublicKey = "path/to/my/certkey.pem"; - public static final String certificatePublicKeyFileName = "certkey.pem"; + public static final String EXTERNALWEBHOOKURL = "https://example.changeme.com:" + PORT; // https://(xyz.)externaldomain.tld + public static final String INTERNALWEBHOOKURL = "https://localhost.changeme.com:" + PORT; // https://(xyz.)localip/domain(.tld) + public static final String pathToCertificatePublicKey = "./YOURPEM.pem"; //only for self-signed webhooks + public static final String pathToCertificateStore = "./YOURSTORE.jks"; //self-signed and non-self-signed. + public static final String certificateStorePassword = "yourpass"; //password for your certificate-store public static final String OPENWEATHERAPIKEY = ""; diff --git a/src/main/java/org/telegram/Main.java b/src/main/java/org/telegram/Main.java index 474e4ff..0aef971 100644 --- a/src/main/java/org/telegram/Main.java +++ b/src/main/java/org/telegram/Main.java @@ -4,12 +4,7 @@ import org.telegram.telegrambots.TelegramApiException; import org.telegram.telegrambots.TelegramBotsApi; import org.telegram.telegrambots.logging.BotLogger; import org.telegram.telegrambots.logging.BotsFileHandler; -import org.telegram.updateshandlers.ChannelHandlers; -import org.telegram.updateshandlers.DirectionsHandlers; -import org.telegram.updateshandlers.FilesHandlers; -import org.telegram.updateshandlers.RaeHandlers; -import org.telegram.updateshandlers.TransifexHandlers; -import org.telegram.updateshandlers.WeatherHandlers; +import org.telegram.updateshandlers.*; import java.io.IOException; import java.util.logging.ConsoleHandler; @@ -32,17 +27,44 @@ public class Main { } catch (IOException e) { BotLogger.severe("MAIN", e); } + // default, start all sample bots in getUpdates mode + if (!BuildVars.useWebHook) { + TelegramBotsApi telegramBotsApi = new TelegramBotsApi(); - TelegramBotsApi telegramBotsApi = new TelegramBotsApi(); - try { + try { telegramBotsApi.registerBot(new ChannelHandlers()); telegramBotsApi.registerBot(new DirectionsHandlers()); telegramBotsApi.registerBot(new RaeHandlers()); telegramBotsApi.registerBot(new WeatherHandlers()); telegramBotsApi.registerBot(new TransifexHandlers()); telegramBotsApi.registerBot(new FilesHandlers()); - } catch (TelegramApiException e) { - BotLogger.error(LOGTAG, e); + + } catch (TelegramApiException e) { + BotLogger.error(LOGTAG, e); + } + // Filled a path to a pem file ? looks like you're going for the self signed option then, invoke with store and pem file to supply. + // check https://core.telegram.org/bots/self-signed#java-keystore for generating a keypair in store and exporting the pem. + // dont forget to split the pem bundle (begin/end), use only the public key as input! + } else if (!BuildVars.pathToCertificatePublicKey.isEmpty()) { + try { + TelegramBotsApi telegramBotsSelfWebhookApi = new TelegramBotsApi(BuildVars.pathToCertificateStore, BuildVars.certificateStorePassword, BuildVars.EXTERNALWEBHOOKURL, BuildVars.INTERNALWEBHOOKURL,BuildVars.pathToCertificatePublicKey); + telegramBotsSelfWebhookApi.registerBot(new webHookExampleHandlers()); + } catch (Exception e) { + BotLogger.error(LOGTAG, e); + } + } else { + // Non self signed, make sure you've added private/public and if needed intermediate to your cert-store. + // Coming from a set of pem files here's one way to do it: + // openssl pkcs12 -export -in public.pem -inkey private.pem > keypair.p12 + // keytool -importkeystore -srckeystore keypair.p12 -destkeystore server.jks -srcstoretype pkcs12 + // have (an) intermediate(s) to supply? first: cat public.pem intermediate.pem > set.pem (use set.pem as -in) + try { + TelegramBotsApi telegramBotsWebhookApi = new TelegramBotsApi(BuildVars.pathToCertificateStore, BuildVars.certificateStorePassword, BuildVars.EXTERNALWEBHOOKURL, BuildVars.INTERNALWEBHOOKURL); + telegramBotsWebhookApi.registerBot(new webHookExampleHandlers()); + } catch (Exception e) { + BotLogger.error(LOGTAG, e); + } + } } } diff --git a/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java b/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java new file mode 100644 index 0000000..d9c8a7a --- /dev/null +++ b/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java @@ -0,0 +1,47 @@ +package org.telegram.updateshandlers; + +import org.telegram.BotConfig; +import org.telegram.BuildVars; +import org.telegram.telegrambots.api.methods.BotApiMethod; +import org.telegram.telegrambots.api.methods.send.SendMessage; +import org.telegram.telegrambots.api.objects.Update; +import org.telegram.telegrambots.bots.TelegramWebhookBot; +import org.telegram.telegrambots.logging.BotLogger; + +/** + * Created by pithera on 5/31/16. + * Yes this is an ugly example, feel free to supply something nice. + */ +public class webHookExampleHandlers extends TelegramWebhookBot { + @Override + public BotApiMethod onWebhookUpdateReceived(Update update) { + BotLogger.severe("UPDATE", update.toString()); + if (update.hasMessage() && update.getMessage().hasText()) { + SendMessage sendMessage = new SendMessage(); + sendMessage.setChatId(update.getMessage().getChatId().toString()); + sendMessage.setText("Your webhook works!, this is your callback:\n" + BuildVars.EXTERNALWEBHOOKURL + "/" + + "callback/" + getBotPath()); + return sendMessage; + } + return null; + } + + + @Override + public String getBotUsername() { + return BotConfig.USERNAMEWEBHOOK; + } + + @Override + public String getBotToken() { + return BotConfig.TOKENWEBHOOK; + } + + @Override + public String getBotPath() { + return BotConfig.USERNAMEWEBHOOK; + } //arbitrary path to deliver updates on, username is an example. + + +} + From 2d748832b06c97e15d02eaf1a0ffb6055c02fac6 Mon Sep 17 00:00:00 2001 From: Rubenlagus Date: Tue, 31 May 2016 21:26:58 +0200 Subject: [PATCH 3/6] 1. Webhook sample --- ...thub_rubenlagus_TelegramBots_v2_3_3_2.xml} | 8 +- ...benlagus_TelegramBots_v2_3_3_2_alpha_2.xml | 13 --- BotAPi.iml | 2 + src/main/java/org/telegram/Main.java | 102 ++++++++++++------ .../webHookExampleHandlers.java | 24 ++--- 5 files changed, 84 insertions(+), 65 deletions(-) rename .idea/libraries/{Maven__com_github_rubenlagus_TelegramBots_v2_3_3_1.xml => Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2.xml} (66%) delete mode 100644 .idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2_alpha_2.xml diff --git a/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_1.xml b/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2.xml similarity index 66% rename from .idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_1.xml rename to .idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2.xml index 00b2b88..4154829 100644 --- a/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_1.xml +++ b/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2_alpha_2.xml b/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2_alpha_2.xml deleted file mode 100644 index 37ba0be..0000000 --- a/.idea/libraries/Maven__com_github_rubenlagus_TelegramBots_v2_3_3_2_alpha_2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/BotAPi.iml b/BotAPi.iml index 827dbc7..14a48d3 100644 --- a/BotAPi.iml +++ b/BotAPi.iml @@ -12,6 +12,8 @@ + + diff --git a/src/main/java/org/telegram/Main.java b/src/main/java/org/telegram/Main.java index 0aef971..cc1b17a 100644 --- a/src/main/java/org/telegram/Main.java +++ b/src/main/java/org/telegram/Main.java @@ -4,7 +4,13 @@ import org.telegram.telegrambots.TelegramApiException; import org.telegram.telegrambots.TelegramBotsApi; import org.telegram.telegrambots.logging.BotLogger; import org.telegram.telegrambots.logging.BotsFileHandler; -import org.telegram.updateshandlers.*; +import org.telegram.updateshandlers.ChannelHandlers; +import org.telegram.updateshandlers.DirectionsHandlers; +import org.telegram.updateshandlers.FilesHandlers; +import org.telegram.updateshandlers.RaeHandlers; +import org.telegram.updateshandlers.TransifexHandlers; +import org.telegram.updateshandlers.WeatherHandlers; +import org.telegram.updateshandlers.WebHookExampleHandlers; import java.io.IOException; import java.util.logging.ConsoleHandler; @@ -25,46 +31,76 @@ public class Main { try { BotLogger.registerLogger(new BotsFileHandler()); } catch (IOException e) { - BotLogger.severe("MAIN", e); + BotLogger.severe(LOGTAG, e); } - // default, start all sample bots in getUpdates mode - if (!BuildVars.useWebHook) { - TelegramBotsApi telegramBotsApi = new TelegramBotsApi(); + try { + TelegramBotsApi telegramBotsApi = createTelegramBotsApi(); try { - telegramBotsApi.registerBot(new ChannelHandlers()); - telegramBotsApi.registerBot(new DirectionsHandlers()); - telegramBotsApi.registerBot(new RaeHandlers()); - telegramBotsApi.registerBot(new WeatherHandlers()); - telegramBotsApi.registerBot(new TransifexHandlers()); - telegramBotsApi.registerBot(new FilesHandlers()); - + // Register long polling bots. They work regardless type of TelegramBotsApi we are creating + telegramBotsApi.registerBot(new ChannelHandlers()); + telegramBotsApi.registerBot(new DirectionsHandlers()); + telegramBotsApi.registerBot(new RaeHandlers()); + telegramBotsApi.registerBot(new WeatherHandlers()); + telegramBotsApi.registerBot(new TransifexHandlers()); + telegramBotsApi.registerBot(new FilesHandlers()); } catch (TelegramApiException e) { BotLogger.error(LOGTAG, e); } + } catch (Exception e) { + BotLogger.error(LOGTAG, e); + } + } + + private static TelegramBotsApi createTelegramBotsApi() throws TelegramApiException { + TelegramBotsApi telegramBotsApi; + if (!BuildVars.useWebHook) { + // Default (long polling only) + telegramBotsApi = createLongPollingTelegramBotsApi(); + } else if (!BuildVars.pathToCertificatePublicKey.isEmpty()) { // Filled a path to a pem file ? looks like you're going for the self signed option then, invoke with store and pem file to supply. - // check https://core.telegram.org/bots/self-signed#java-keystore for generating a keypair in store and exporting the pem. - // dont forget to split the pem bundle (begin/end), use only the public key as input! - } else if (!BuildVars.pathToCertificatePublicKey.isEmpty()) { - try { - TelegramBotsApi telegramBotsSelfWebhookApi = new TelegramBotsApi(BuildVars.pathToCertificateStore, BuildVars.certificateStorePassword, BuildVars.EXTERNALWEBHOOKURL, BuildVars.INTERNALWEBHOOKURL,BuildVars.pathToCertificatePublicKey); - telegramBotsSelfWebhookApi.registerBot(new webHookExampleHandlers()); - } catch (Exception e) { - BotLogger.error(LOGTAG, e); - } - } else { + telegramBotsApi = createSelfSignedTelegramBotsApi(); + telegramBotsApi.registerBot(new WebHookExampleHandlers()); + } else { // Non self signed, make sure you've added private/public and if needed intermediate to your cert-store. - // Coming from a set of pem files here's one way to do it: - // openssl pkcs12 -export -in public.pem -inkey private.pem > keypair.p12 - // keytool -importkeystore -srckeystore keypair.p12 -destkeystore server.jks -srcstoretype pkcs12 - // have (an) intermediate(s) to supply? first: cat public.pem intermediate.pem > set.pem (use set.pem as -in) - try { - TelegramBotsApi telegramBotsWebhookApi = new TelegramBotsApi(BuildVars.pathToCertificateStore, BuildVars.certificateStorePassword, BuildVars.EXTERNALWEBHOOKURL, BuildVars.INTERNALWEBHOOKURL); - telegramBotsWebhookApi.registerBot(new webHookExampleHandlers()); - } catch (Exception e) { - BotLogger.error(LOGTAG, e); - } - + telegramBotsApi = createNoSelfSignedTelegramBotsApi(); + telegramBotsApi.registerBot(new WebHookExampleHandlers()); } + return telegramBotsApi; + } + + /** + * @brief Creates a Telegram Bots Api to use Long Polling (getUpdates) bots. + * @return TelegramBotsApi to register the bots. + */ + private static TelegramBotsApi createLongPollingTelegramBotsApi() { + return new TelegramBotsApi(); + } + + /** + * @brief Creates a Telegram Bots Api to use Long Polling bots and webhooks bots with self-signed certificates. + * @return TelegramBotsApi to register the bots. + * + * @note https://core.telegram.org/bots/self-signed#java-keystore for generating a keypair in store and exporting the pem. + * @note Don't forget to split the pem bundle (begin/end), use only the public key as input! + */ + private static TelegramBotsApi createSelfSignedTelegramBotsApi() throws TelegramApiException { + return new TelegramBotsApi(BuildVars.pathToCertificateStore, BuildVars.certificateStorePassword, BuildVars.EXTERNALWEBHOOKURL, BuildVars.INTERNALWEBHOOKURL, BuildVars.pathToCertificatePublicKey); + } + + /** + * @brief Creates a Telegram Bots Api to use Long Polling bots and webhooks bots with no-self-signed certificates. + * @return TelegramBotsApi to register the bots. + * + * @note Coming from a set of pem files here's one way to do it: + * @code{.sh} + * openssl pkcs12 -export -in public.pem -inkey private.pem > keypair.p12 + * keytool -importkeystore -srckeystore keypair.p12 -destkeystore server.jks -srcstoretype pkcs12 + * #have (an) intermediate(s) to supply? first: + * cat public.pem intermediate.pem > set.pem (use set.pem as -in) + * @endcode + */ + private static TelegramBotsApi createNoSelfSignedTelegramBotsApi() throws TelegramApiException { + return new TelegramBotsApi(BuildVars.pathToCertificateStore, BuildVars.certificateStorePassword, BuildVars.EXTERNALWEBHOOKURL, BuildVars.INTERNALWEBHOOKURL); } } diff --git a/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java b/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java index d9c8a7a..fc73c93 100644 --- a/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java +++ b/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java @@ -1,32 +1,29 @@ package org.telegram.updateshandlers; import org.telegram.BotConfig; -import org.telegram.BuildVars; import org.telegram.telegrambots.api.methods.BotApiMethod; import org.telegram.telegrambots.api.methods.send.SendMessage; import org.telegram.telegrambots.api.objects.Update; import org.telegram.telegrambots.bots.TelegramWebhookBot; -import org.telegram.telegrambots.logging.BotLogger; /** - * Created by pithera on 5/31/16. - * Yes this is an ugly example, feel free to supply something nice. + * @author pithera + * @version 1.0 + * @brief Simple Webhook example + * @date 31 of May of 2016 */ -public class webHookExampleHandlers extends TelegramWebhookBot { +public class WebHookExampleHandlers extends TelegramWebhookBot { @Override public BotApiMethod onWebhookUpdateReceived(Update update) { - BotLogger.severe("UPDATE", update.toString()); if (update.hasMessage() && update.getMessage().hasText()) { SendMessage sendMessage = new SendMessage(); sendMessage.setChatId(update.getMessage().getChatId().toString()); - sendMessage.setText("Your webhook works!, this is your callback:\n" + BuildVars.EXTERNALWEBHOOKURL + "/" - + "callback/" + getBotPath()); + sendMessage.setText("Well, all information looks like noise until you break the code."); return sendMessage; } return null; } - @Override public String getBotUsername() { return BotConfig.USERNAMEWEBHOOK; @@ -39,9 +36,6 @@ public class webHookExampleHandlers extends TelegramWebhookBot { @Override public String getBotPath() { - return BotConfig.USERNAMEWEBHOOK; - } //arbitrary path to deliver updates on, username is an example. - - -} - + return BotConfig.USERNAMEWEBHOOK; //arbitrary path to deliver updates on, username is an example. + } +} \ No newline at end of file From ff90deb183ec21a1de1e68a776260eedc4846325 Mon Sep 17 00:00:00 2001 From: Rubenlagus Date: Tue, 31 May 2016 21:37:08 +0200 Subject: [PATCH 4/6] 1. Add travis support --- .travis.yml | 8 ++++++++ BotAPi.iml | 2 -- pom.xml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2b4c7a2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: java +jdk: + - oraclejdk8 +script: mvn clean compile package +notifications: + webhooks: + secure: "L4E4xS1JJcnUDG2oQtBrz/rGxNK8dEbKIRjH6nNHZRGEjGUQh0ECWTEMotX3GDNZ4iIERwZuUS2saLqytlISHPTbpKegZX+YaVk8s9Zuhm/LgrcqtBp7GaxJj+jUx/TdqL/jjuwmstMgzfmMmsx5ALaukAHr1kvP2188XxEiEL9HyORb3hHHDFNOQCsu/evLnewNs1NnHd+OOGm8YLW1ztxE6z5tMx8nvk7jqHEfSkf3KfbZ6QI7fNcelW26b5bPAKyM3b+99Fyz0rXGRSpYw8x15EB4n7hXwQREoL+iZyuF6mKjsdsndiyFoN7UMfKYsQY31OQQKPpcU8OkuXtNqq6F2zfMacQyCfuYYd7szDykI3C4RYVY76PMI1Eym4C4kRYTeTsoyQyp8Lp6daPM0akOCKXvzI7xc9Cp3/EXtRPjncXTA5LJkLiuMwi0BOFBetoei4nOnLPlR1fTwxLVqx13siWl13aIXNIk4axD0PAmi4IAVmsJOLRWxCEvSgS5MQ+M0AZibilQOsZlTipbRovmhe+DkMZifU/mjTkF9DhLjMl1HawFAClell3JcU7IceHwfkZDGE036yvtUi3axcvyR4Sr7qMRno9MOkSbhKp3gQqTVCd7arZrKMhdAYf7PIu9IDUs2+2zlZp2pq2OlMc9c5Z+tXgcX+JqzB3GlHc=" + email: false \ No newline at end of file diff --git a/BotAPi.iml b/BotAPi.iml index 14a48d3..827dbc7 100644 --- a/BotAPi.iml +++ b/BotAPi.iml @@ -12,8 +12,6 @@ - - diff --git a/pom.xml b/pom.xml index 06f40ed..1982eb8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ BotApi org.telegram.botapi - 2.0 + 2.1 From 13836c8c6044912b1de2e743263854ef74d9578e Mon Sep 17 00:00:00 2001 From: Rubenlagus Date: Tue, 31 May 2016 21:41:06 +0200 Subject: [PATCH 5/6] 1. Update readme --- README.md | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1b9d5d3..3d61754 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,18 @@ # Telegram Bot Java Library -A simple to use library to create Telegram Bots in Java (Still Beta Version) +[![Build Status](https://travis-ci.org/rubenlagus/TelegramBotsExample.svg?branch=master)](https://travis-ci.org/rubenlagus/TelegramBotsExample) +[![Telegram](http://trellobot.doomdns.org/telegrambadge.svg)](https://telegram.me/JavaBotsApi) + +Samples for [TelegramBots](https://github.com/rubenlagus/TelegramBots) library ## 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. - -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. - -I recommend using getUpdates methods. Webhooks a bit less trustful +Feel free to fork this project, work on it and then make a pull request agains **dev** branch. -## Example bots -Open them and send them */help* command to get some information about their capabilities: +Most of the times I will accept them if they add something valuable to the code. -https://telegram.me/weatherbot - -https://telegram.me/directionsbot - -https://telegram.me/filesbot - -https://telegram.me/TGlanguagesbot +Please, **DO NOT PUSH ANY TOKEN OR API KEY**, I will never accept a pull request with that content. ## Telegram Bot API This library use [Telegram bot API](https://core.telegram.org/bots), you can find more information following the link. From 3395c30c8d99306dba9ee69848013aa763ec1ffd Mon Sep 17 00:00:00 2001 From: Ruben Bermudez Date: Tue, 31 May 2016 21:45:05 +0200 Subject: [PATCH 6/6] Rename webHookExampleHandlers.java to WebHookExampleHandlers.java --- ...{webHookExampleHandlers.java => WebHookExampleHandlers.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/main/java/org/telegram/updateshandlers/{webHookExampleHandlers.java => WebHookExampleHandlers.java} (99%) diff --git a/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java b/src/main/java/org/telegram/updateshandlers/WebHookExampleHandlers.java similarity index 99% rename from src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java rename to src/main/java/org/telegram/updateshandlers/WebHookExampleHandlers.java index fc73c93..f72ef5a 100644 --- a/src/main/java/org/telegram/updateshandlers/webHookExampleHandlers.java +++ b/src/main/java/org/telegram/updateshandlers/WebHookExampleHandlers.java @@ -38,4 +38,4 @@ public class WebHookExampleHandlers extends TelegramWebhookBot { public String getBotPath() { return BotConfig.USERNAMEWEBHOOK; //arbitrary path to deliver updates on, username is an example. } -} \ No newline at end of file +}