!7 !include once #1017511 // Telegram Bots p-exp { fS apiToken = telegramBotToken_mandatory(); ApiContextInitializer.init(); TelegramLongPollingBot bot = new TelegramLongPollingBot { public S getBotUsername() { ret "HelloComputer_bot"; } public S getBotToken() { ret apiToken; } public void onUpdateReceived(Update update) { pcall { print("Got update! " + update); Message msg = update.getChannelPost(); if (msg != null && msg.hasText()) { S text = msg.getText(); print("Text: " + text); S response = "You typed " + n2(l(text), "character"); Chat chat = msg.getChat(); new SendMessage sending; sending.setText(response); sending.setChatId(msg.getChatId()); sendMessage(sending); } } } }; new TelegramBotsApi().registerBot(bot); }