TelegramBots icon indicating copy to clipboard operation
TelegramBots copied to clipboard

How to launch a bot using serverlessWebhook?

Open lis3809 opened this issue 2 years ago • 0 comments

Good afternoon, I didn't find a ready-made example anywhere, I tried to run it myself, but it didn't work! Please tell me what I did wrong or what else I need to add? @WebServlet("/") public class MainServletForBot extends HttpServlet { @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) { try { //Создаем объект нашего бота WebHookSportikBot webHookSportikBot = new WebHookSportikBot(); //Устанавливаем вебхук SetWebhook setWebhook = new SetWebhook(webHookSportikBot.getBotPath()); ServerlessWebhook serverlessWebhook = new ServerlessWebhook(); //Регистрируем бота TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class, serverlessWebhook); telegramBotsApi.registerBot(webHookSportikBot, setWebhook); } catch (TelegramApiException exception) { exception.printStackTrace(); } } }

lis3809 avatar Jul 03 '22 19:07 lis3809