Fix unhandled exception type error in examples

This commit is contained in:
Dhina17 2020-11-08 02:58:47 +05:30
parent b2fcbaa3c2
commit c42955985e
4 changed files with 6 additions and 7 deletions

View File

@ -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());

View File

@ -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();

View File

@ -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();

View File

@ -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) {