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

31
LINES

< > BotCompany Repo | #1001218 // Reboot Bot (Linux/Windows)

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

Libraryless. Click here for Pure Java version (1801L/12K/40K).

1  
!747
2  
3  
m {
4  
  static new L<long> rebootLog;
5  
  
6  
  p {
7  
    readLocally("rebootLog");
8  
    makeAndroid("Reboot Bot.");
9  
  }
10  
  
11  
  static synchronized S answer(S s) {
12  
    if (match3("Please reboot the machine.", s)) {
13  
      final S cmd = isWindows() ? "shutdown -t 5 -r" : "reboot";
14  
      print(cmd);
15  
      S answer = "Rebooting in 5 seconds!";
16  
      print(answer);
17  
      rebootLog.add(now());
18  
      saveLocally("rebootLog");
19  
      thread {
20  
        sleepSeconds(5);
21  
        backtick(cmd);
22  
      }
23  
      return answer;
24  
    }
25  
    
26  
    if (match3("How many reboots have you done?", s))
27  
      return "" + rebootLog.size();
28  
    
29  
    return null;
30  
  }
31  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001218
Snippet name: Reboot Bot (Linux/Windows)
Eternal ID of this version: #1001218/1
Text MD5: b4f4462aca7e05d49bc524d4490d0bbd
Transpilation MD5: 74d7e2dd377b6eb501fa3c1b2ed8bc2f
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-11-13 17:29:34
Source code size: 667 bytes / 31 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 580 / 1275
Referenced in: [show references]