-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTelegramBotApplication.java
More file actions
31 lines (25 loc) Β· 944 Bytes
/
TelegramBotApplication.java
File metadata and controls
31 lines (25 loc) Β· 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package umg.TelegramBot;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;
import umg.TelegramBot.Service.TelegramBotService;
@SpringBootApplication
public class TelegramBotApplication implements CommandLineRunner {
@Autowired
private TelegramBotService telegramBotService;
public static void main(String[] args) {
SpringApplication.run(TelegramBotApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
TelegramBotsApi botsApi = new TelegramBotsApi(DefaultBotSession.class);
try {
botsApi.registerBot(telegramBotService);
} catch (Exception e) {
e.printStackTrace();
}
}
}