/** * Register a bot. The Bot Session is started immediately, and may be disconnected by calling close. * @param bot the bot to register */ public BotSession registerBot(LongPollingBot bot) throws TelegramApiRequestException { bot.clearWebhook(); BotSession session = ApiContext.getInstance(BotSession.class); session.setToken(bot.getBotToken()); session.setOptions(bot.getOptions()); session.setCallback(bot); session.start(); return session; }
/** * Register a bot. The Bot Session is started immediately, and may be disconnected by calling close. * @param bot the bot to register */ public BotSession registerBot(LongPollingBot bot) throws TelegramApiRequestException { bot.clearWebhook(); BotSession session = ApiContext.getInstance(BotSession.class); session.setToken(bot.getBotToken()); session.setOptions(bot.getOptions()); session.setCallback(bot); session.start(); return session; }