use of org.telegram.telegrambots.generics.BotSession in project telegram-notifications-plugin by jenkinsci.
the class TelegramBotThread method run.
@Override
public void run() {
try {
// Start bot session
BotSession session = TELEGRAM_BOTS_API.registerBot(bot);
LOGGER.finest("BotSession was started");
while (true) {
if (isInterrupted()) {
// If thread was interrupted bot session should be closed
session.stop();
LOGGER.finest("BotSession was closed");
break;
}
}
} catch (TelegramApiException e) {
LOGGER.log(Level.SEVERE, "Telegram API error", e);
interrupt();
}
}
Aggregations