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

46
LINES

< > BotCompany Repo | #1017568 // Telegram Think Bot [Dyn Module, OK]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 408K of libraries. Compilation Failed (19743L/145K).

1  
!7
2  
3  
set flag DynModule.
4  
5  
sclass TelegramThinkBot > DynPrintLog {
6  
  void start {
7  
    loadFunctions_preferCached();
8  
    
9  
    watchStructureLog_plusLastLine(500, telegramLogFile(), voidfunc(Map map) {
10  
      printStruct(map);
11  
      
12  
      try {
13  
        
14  
        makeAndCall_initChild.set(voidfunc(Class c) { copyFields(mc(), c, 'telegram_msg_tl) });
15  
        temp tempSetThreadLocal(telegram_msg_tl(), map);
16  
        
17  
        S s = getString(map, 'text);
18  
        new Matches m;
19  
        S procedure = nlLookup(mechMap("Telegram Procedures"), s, m);
20  
        if (procedure != null) {
21  
          procedure = expandDollarRefsToMatches(procedure, m, true);
22  
          print(">> " + procedure);
23  
          postMessage(strOrNull(javaEvalOrInterpret(procedure)));
24  
        }
25  
        
26  
        if (swic_trim(s, "!parse ", m))
27  
          postMessage(ai_renderCulledParseTree(ai_parseToTreeWithGuessing(m.rest())));
28  
        
29  
        if (swic_trim(s, "!simplify ", m))
30  
          postMessage(lines(ai_parseTree_simplifiedTexts(ai_parseToTreeWithGuessing(m.rest()))));
31  
        
32  
        if (telegram_amIAuthorized()) {
33  
          if (swic_trim(s, "!eval ", m))
34  
            postMessage(strOrNull(javaEvalOrInterpret(m.rest())));
35  
        }
36  
      } catch e {
37  
        printStackTrace(e);
38  
        postMessage(exceptionToStringShort(e));
39  
      }
40  
    });
41  
  }
42  
  
43  
  void postMessage(S s) {
44  
    telegram_postToSendLog(s);
45  
  }
46  
}

Author comment

Began life as a copy of #1017546

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: #1017568
Snippet name: Telegram Think Bot [Dyn Module, OK]
Eternal ID of this version: #1017568/17
Text MD5: 2963a17c92b8d1805c5f3a3753b3d7ba
Transpilation MD5: 730f014a90613e52249ad762cf850f8a
Author: stefan
Category: javax / telegram
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-27 20:33:06
Source code size: 1433 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 361 / 1514
Version history: 16 change(s)
Referenced in: [show references]