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).

1  
!7
2  
3  
lib 1400113 // TelegramBots
4  
5  
import org.telegram.telegrambots.*;
6  
import org.telegram.telegrambots.bots.*;
7  
import org.telegram.telegrambots.api.objects.Update;
8  
9  
p-exp {
10  
  fS apiToken = trim(loadTextFileMandatory(javaxSecretDir("telegram-bot-token.txt")));
11  
12  
  ApiContextInitializer.init();
13  
  TelegramLongPollingBot bot = new TelegramLongPollingBot {
14  
    public S getBotUsername() { ret "HelloComputer_bot"; }
15  
    public S getBotToken() { ret apiToken; }
16  
    
17  
    public void onUpdateReceived(Update update) {
18  
      pcall {
19  
        print("Got update! " + update);
20  
      }
21  
    }
22  
  };
23  
24  
  new TelegramBotsApi api;
25  
  api.registerBot(bot);
26  
}

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: 438 / 1158
Version history: 7 change(s)
Referenced in: [show references]