Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1017466 // Telegram Bot Spike 5 (new library, OK)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 16251K of libraries. Click here for Pure Java version (5610L/40K).

!7

lib 1400113 // TelegramBots

import org.telegram.telegrambots.*;
import org.telegram.telegrambots.bots.*;
import org.telegram.telegrambots.api.objects.Update;

p-exp {
  fS apiToken = trim(loadTextFileMandatory(javaxSecretDir("telegram-bot-token.txt")));

  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);
      }
    }
  };

  new TelegramBotsApi api;
  api.registerBot(bot);
}

Author comment

Began life as a copy of #1017465

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017466
Snippet name: Telegram Bot Spike 5 (new library, OK)
Eternal ID of this version: #1017466/8
Text MD5: 0a9086cb9c63dcbdd8e621a20bd4cde9
Transpilation MD5: f55a2138c2b854e18d5d9bfaeb393d49
Author: stefan
Category: javax / networking
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-23 15:54:16
Source code size: 662 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 436 / 1153
Version history: 7 change(s)
Referenced in: [show references]