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

43
LINES

< > BotCompany Repo | #1001423 // Bot Starter (all in one VM)

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

Libraryless. Click here for Pure Java version (1488L/11K/36K).

!747

m {
  static L<S> startableBots = litlist("Text Bot.", "#1001417");
  
  p {
    makeAndroid3("Bot Starter.");
  }
  
  static synchronized S answer(S s, L<S> history) {
    new Matches m;
    
    if (match3("please start bot * and return port", s, m)) {
      S botName = unquote(m.m[0]);
      int port = getBotPort(botName);
      if (port == 0)
        port = startBot(botName);

      if (port == 0)
        return format3("Sorry. Could not start bot *", botName);
      
      return format3("OK. Port: *", port);
    }
    
    ret null;
  }
  
  // This maybe blocks stuff a little long... well.
  
  static int startBot(S botName) {
    for (int i = 0; i < startableBots.size(); i += 2) {
      S name = startableBots.get(i);
      if (name.startsWith(botName)) {
        S botID = startableBots.get(i+1);
        final Class c = hotwire(botID);
        thread { callMain(c); }
        ret waitForBotStartUp(botName);
      }
    }
    
    ret 0;
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001423
Snippet name: Bot Starter (all in one VM)
Eternal ID of this version: #1001423/1
Text MD5: a8f82ef187c05190bffa9f0e45817d40
Transpilation MD5: 96493f4b8bee95c90058ffdc27966b88
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-15 19:49:23
Source code size: 1011 bytes / 43 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 546 / 563
Referenced in: [show references]