Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static final Logger logger = LogManager.getLogger("name");
- public static void main(String[] args) throws Exception {
- ApiContextInitializer.init();
- TelegramBotsApi telegramBotsApi = new TelegramBotsApi();
- try {
- telegramBotsApi.registerBot(new TelegramLongPollingBot() {
- @Override
- public String getBotToken() {
- return Reference.BOT_NAME;
- }
- @Override
- public void onUpdateReceived(Update update) {
- if (update.hasMessage()) {
- if (update.getMessage().hasText()) {
- logger.info(update.getMessage().getText());
- }
- }
- }
- @Override
- public String getBotUsername() {
- return Reference.BOT_TOKEN;
- }
- });
- } catch (TelegramApiException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement