Fix unhandled exception type error in examples
This commit is contained in:
parent
b2fcbaa3c2
commit
c42955985e
@ -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());
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
try {
|
||||
// Create the TelegramBotsApi object to register your bots
|
||||
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
|
||||
|
||||
try {
|
||||
// Register your newly created AbilityBot
|
||||
botsApi.registerBot(new HelloBot());
|
||||
} catch (TelegramApiException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user