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

46
LINES

< > BotCompany Repo | #1001345 // Channel Bridge Bot (developing)

JavaX source code - run with: x30.jar

1  
!747
2  
3  
m {
4  
  static new Map<S, Channel> channels;
5  
  
6  
  static class Channel {
7  
    S id, S pw;
8  
    S computer1, computer2;
9  
    //new L<S> computersLoggedIn;
10  
  }
11  
  
12  
  p {
13  
    makeAndroid3("Channel Bridge Bot.");
14  
  }
15  
  
16  
  static synchronized S answer(S s, L<S> history) {
17  
    Channel c = getChannel(id);
18  
    S computerID = getComputerID(history);
19  
    
20  
    if (match3("this is computer *", s))
21  
      return "ok";
22  
      
23  
    if (match3("please send: "))
24  
      TODO
25  
      
26  
    return null;
27  
  }
28  
  
29  
  static S getComputerID(L<S> history) {
30  
    new Matches m;
31  
    for (S s : history)
32  
      if (match3("this is computer *", s, m))
33  
        return unquote(m.m[0]);
34  
    return null;
35  
  }
36  
  
37  
  static Channel getChannel(S id) {
38  
    Channel c = channels.get(id);
39  
    if (c == null) {
40  
      c = new Channel;
41  
      c.id = id;
42  
      channels.put(id, c);
43  
    }
44  
    return c;
45  
  }
46  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001345
Snippet name: Channel Bridge Bot (developing)
Eternal ID of this version: #1001345/1
Text MD5: 9bb8fa123b81bae660de65a8af01ddee
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-10 19:15:00
Source code size: 904 bytes / 46 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 688 / 616
Referenced in: [show references]