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

!7

set flag DynModule.

sclass TelegramThinkBot > DynPrintLog {
  void start {
    loadFunctions_preferCached();
    
    watchStructureLog_plusLastLine(500, telegramLogFile(), voidfunc(Map map) {
      printStruct(map);
      
      try {
        
        makeAndCall_initChild.set(voidfunc(Class c) { copyFields(mc(), c, 'telegram_msg_tl) });
        temp tempSetThreadLocal(telegram_msg_tl(), map);
        
        S s = getString(map, 'text);
        new Matches m;
        S procedure = nlLookup(mechMap("Telegram Procedures"), s, m);
        if (procedure != null) {
          procedure = expandDollarRefsToMatches(procedure, m, true);
          print(">> " + procedure);
          postMessage(strOrNull(javaEvalOrInterpret(procedure)));
        }
        
        if (swic_trim(s, "!parse ", m))
          postMessage(ai_renderCulledParseTree(ai_parseToTreeWithGuessing(m.rest())));
        
        if (swic_trim(s, "!simplify ", m))
          postMessage(lines(ai_parseTree_simplifiedTexts(ai_parseToTreeWithGuessing(m.rest()))));
        
        if (telegram_amIAuthorized()) {
          if (swic_trim(s, "!eval ", m))
            postMessage(strOrNull(javaEvalOrInterpret(m.rest())));
        }
      } catch e {
        printStackTrace(e);
        postMessage(exceptionToStringShort(e));
      }
    });
  }
  
  void postMessage(S s) {
    telegram_postToSendLog(s);
  }
}

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