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

37
LINES

< > BotCompany Repo | #1003120 // Bob (dev.)

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

Libraryless. Click here for Pure Java version (2150L/15K/49K).

1  
!752
2  
3  
static S name = "Bob";
4  
static new L<S> knownBots;
5  
static bool saidThatIAmABot;
6  
7  
p {
8  
  print("Bob Print Test, print_log=" + systemHashCode(print_log) + ", local_log=" + systemHashCode(local_log));
9  
  thread "Bob" {
10  
    simpleChatListen();
11  
    simpleChatPresence(name);
12  
    simpleChatPost("Hey yo, I'm " + name + "!");
13  
    simpleChatWait();
14  
    simpleChatPost("Any bots here?!");
15  
  }
16  
}
17  
18  
static void process(L msgs) {
19  
  for (O msg : msgs) {
20  
    S text = getString(msg, "text");
21  
    S user = getString(msg, "user");
22  
    print(name + ": msg " + quote(text) + " " + quote(user));
23  
    if (eq(user, name)) continue;
24  
    
25  
    if (eqic(text, "I'm a bot") && !knownBots.contains(user)) {
26  
      setAdd(knownBots, user);
27  
      simpleChatPost("Cool. Hello " + user + "!"
28  
        + (saidThatIAmABot ? "" : " I'm a bot too."));
29  
      //saidThatIAmABot = true;
30  
    }
31  
    
32  
    if (eqic(text, "Any bots here?!") && !saidThatIAmABot) {
33  
      simpleChatPost("I'm a bot");
34  
      //saidThatIAmABot = true;
35  
    }
36  
  }
37  
}

Author comment

Began life as a copy of #1003092

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1003120
Snippet name: Bob (dev.)
Eternal ID of this version: #1003120/1
Text MD5: 588243bf3f2be1d454242446968f30e8
Transpilation MD5: 67ee8bde42f6869e3560b3ce3da73d9e
Author: stefan
Category: eleu / nl
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-06-06 00:55:52
Source code size: 1035 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 588 / 1082
Referenced in: [show references]