Libraryless. Click here for Pure Java version (1488L/11K/36K).
1 | !747 |
2 | |
3 | m { |
4 | static L<S> startableBots = litlist("Text Bot.", "#1001417"); |
5 | |
6 | p { |
7 | makeAndroid3("Bot Starter."); |
8 | } |
9 | |
10 | static synchronized S answer(S s, L<S> history) { |
11 | new Matches m; |
12 | |
13 | if (match3("please start bot * and return port", s, m)) { |
14 | S botName = unquote(m.m[0]); |
15 | int port = getBotPort(botName); |
16 | if (port == 0) |
17 | port = startBot(botName); |
18 | |
19 | if (port == 0) |
20 | return format3("Sorry. Could not start bot *", botName); |
21 | |
22 | return format3("OK. Port: *", port); |
23 | } |
24 | |
25 | ret null; |
26 | } |
27 | |
28 | // This maybe blocks stuff a little long... well. |
29 | |
30 | static int startBot(S botName) { |
31 | for (int i = 0; i < startableBots.size(); i += 2) { |
32 | S name = startableBots.get(i); |
33 | if (name.startsWith(botName)) { |
34 | S botID = startableBots.get(i+1); |
35 | final Class c = hotwire(botID); |
36 | thread { callMain(c); } |
37 | ret waitForBotStartUp(botName); |
38 | } |
39 | } |
40 | |
41 | ret 0; |
42 | } |
43 | } |
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: | 618 / 652 |
Referenced in: | [show references] |