From c42955985ea229ab2488b8db047fac4fb18e849f Mon Sep 17 00:00:00 2001 From: Dhina17 Date: Sun, 8 Nov 2020 02:58:47 +0530 Subject: [PATCH] Fix unhandled exception type error in examples --- README.md | 2 +- TelegramBots.wiki/Getting-Started.md | 3 +-- TelegramBots.wiki/Using-Http-Proxy.md | 2 +- TelegramBots.wiki/abilities/Simple-Example.md | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c7ddef60..1d7d44f1 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,8 @@ Once done, you just need to create a `org.telegram.telegrambots.meta.TelegramBot // Example taken from https://github.com/rubenlagus/TelegramBotsExample public class Main { public static void main(String[] args) { - TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class); try { + TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class); telegramBotsApi.registerBot(new ChannelHandlers()); telegramBotsApi.registerBot(new DirectionsHandlers()); telegramBotsApi.registerBot(new RaeHandlers()); diff --git a/TelegramBots.wiki/Getting-Started.md b/TelegramBots.wiki/Getting-Started.md index 53ffab72..ef710b88 100644 --- a/TelegramBots.wiki/Getting-Started.md +++ b/TelegramBots.wiki/Getting-Started.md @@ -135,9 +135,8 @@ Now that we have the library, we can start coding. There are few steps to follow public class Main { public static void main(String[] args) { - TelegramBotsApi botsApi = new TelegramBotsApi(); - try { + TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class); botsApi.registerBot(new MyAmazingBot()); } catch (TelegramApiException e) { e.printStackTrace(); diff --git a/TelegramBots.wiki/Using-Http-Proxy.md b/TelegramBots.wiki/Using-Http-Proxy.md index 2a44a9c2..ea0833d5 100644 --- a/TelegramBots.wiki/Using-Http-Proxy.md +++ b/TelegramBots.wiki/Using-Http-Proxy.md @@ -94,7 +94,7 @@ public class Main { }); // Create the TelegramBotsApi object to register your bots - TelegramBotsApi botsApi = new TelegramBotsApi(); + TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class); // Set up Http proxy DefaultBotOptions botOptions = new DefaultBotOptions(); diff --git a/TelegramBots.wiki/abilities/Simple-Example.md b/TelegramBots.wiki/abilities/Simple-Example.md index 7c3b7326..f8f549ac 100644 --- a/TelegramBots.wiki/abilities/Simple-Example.md +++ b/TelegramBots.wiki/abilities/Simple-Example.md @@ -81,10 +81,10 @@ Running the bot is just like running the regular Telegram bots. Create a Java cl ```java public class Application { public static void main(String[] args) { - // Create the TelegramBotsApi object to register your bots - TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class); - try { + // Create the TelegramBotsApi object to register your bots + TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class); + // Register your newly created AbilityBot botsApi.registerBot(new HelloBot()); } catch (TelegramApiException e) {