Merge pull request #830 from Dhina17/dev
Fix unhandled exception type error in examples
This commit is contained in:
commit
0bbe66986b
@ -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
|
// Example taken from https://github.com/rubenlagus/TelegramBotsExample
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);
|
|
||||||
try {
|
try {
|
||||||
|
TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);
|
||||||
telegramBotsApi.registerBot(new ChannelHandlers());
|
telegramBotsApi.registerBot(new ChannelHandlers());
|
||||||
telegramBotsApi.registerBot(new DirectionsHandlers());
|
telegramBotsApi.registerBot(new DirectionsHandlers());
|
||||||
telegramBotsApi.registerBot(new RaeHandlers());
|
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 class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
TelegramBotsApi botsApi = new TelegramBotsApi();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
|
||||||
botsApi.registerBot(new MyAmazingBot());
|
botsApi.registerBot(new MyAmazingBot());
|
||||||
} catch (TelegramApiException e) {
|
} catch (TelegramApiException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -94,7 +94,7 @@ public class Main {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Create the TelegramBotsApi object to register your bots
|
// Create the TelegramBotsApi object to register your bots
|
||||||
TelegramBotsApi botsApi = new TelegramBotsApi();
|
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
|
||||||
|
|
||||||
// Set up Http proxy
|
// Set up Http proxy
|
||||||
DefaultBotOptions botOptions = new DefaultBotOptions();
|
DefaultBotOptions botOptions = new DefaultBotOptions();
|
||||||
|
@ -81,10 +81,10 @@ Running the bot is just like running the regular Telegram bots. Create a Java cl
|
|||||||
```java
|
```java
|
||||||
public class Application {
|
public class Application {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Create the TelegramBotsApi object to register your bots
|
|
||||||
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Create the TelegramBotsApi object to register your bots
|
||||||
|
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
|
||||||
|
|
||||||
// Register your newly created AbilityBot
|
// Register your newly created AbilityBot
|
||||||
botsApi.registerBot(new HelloBot());
|
botsApi.registerBot(new HelloBot());
|
||||||
} catch (TelegramApiException e) {
|
} catch (TelegramApiException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user