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

63
LINES

< > BotCompany Repo | #1001337 // Bot Receiving Bot

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

Libraryless. Click here for Pure Java version (2344L/16K/53K).

1  
!747
2  
3  
m {
4  
  p {
5  
    makeAndroid3("Bot receiving bot.");
6  
  }
7  
  
8  
  static synchronized S answer(S s, L<S> history) {
9  
    new Matches m;
10  
    
11  
    if (match3("please start bot * with data *.", s, m)) {
12  
      S botID = formatSnippetID(unquote(m.m[0]));
13  
      S dataID = formatSnippetID(unquote(m.m[1]));
14  
      return doIt(botID, dataID);
15  
    }
16  
      
17  
    if (match3("please start bot * with no data.", s, m)) {
18  
      S botID = formatSnippetID(unquote(m.m[0]));
19  
      return doIt(botID, null);
20  
    }
21  
      
22  
    if (match3("please start bot from data *.", s, m)) {
23  
      S dataID = formatSnippetID(unquote(m.m[0]));
24  
      S title = getSnippetTitle(dataID);
25  
      if (!find3("zip of #*", title, m))
26  
        fail("Bot ID not found in title: " + quote(title));
27  
      S botID = formatSnippetID(unquote(m.m[0]));
28  
      return doIt(botID, dataID);
29  
    }
30  
      
31  
    return null;
32  
  }
33  
  
34  
  static S doIt(S botID, S dataID) {
35  
    print("Killing " + botID);
36  
    killProgramID(botID);
37  
    
38  
    if (dataID == null) {
39  
      print("Clearing data directory for " + botID);
40  
      backupAndCleanProgramDir(botID);
41  
    } else {
42  
      print("Unpacking " + dataID + " for " + botID);
43  
      unpackProgramData(botID, dataID);
44  
    }
45  
    
46  
    print("Starting " + botID);
47  
    nohupJavax("" + parseSnippetID(botID));
48  
    
49  
    return "All done.";
50  
  }
51  
  
52  
  static void unpackProgramData(S botID, S dataID) {
53  
    // TODO: check if the same data is there already,
54  
    // then skip all this.
55  
    
56  
    if (sameSnippetID(dataID, "#1001471"))
57  
      dataID = null;
58  
    
59  
    backupAndCleanProgramDir(botID);
60  
    if (dataID != null)
61  
      zip2dir(loadLibrary(dataID), new File(userHome()), "JavaX-Data/" + formatSnippetID(botID));
62  
  }
63  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001337
Snippet name: Bot Receiving Bot
Eternal ID of this version: #1001337/1
Text MD5: 2d55ee1e865c690a097d34bdbd517b9e
Transpilation MD5: b78f3b27510d026c76dd3475d863882d
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-17 19:17:21
Source code size: 1753 bytes / 63 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 591 / 1079
Referenced in: [show references]