Uses 5909K of libraries. Click here for Pure Java version (9822L/52K).
!7 cmodule ClustersBot extends DynTalkBot2<ClustersBot.ByServer> { start { makeByServer = () -> new ByServer; useAGIBlueForDropPunctuation = false; preprocessAtSelfToMyName = false; } class ByServer extends DynTalkBot2.ByServer { delegate Cluster to StringClustersWithIDs. new StringClustersWithIDs clusters; Cluster topic; void _doneLoading { clusters.onChange(r change); } synchronized S processSimplifiedLine(S s, O... _) { try answer super.processSimplifiedLine(s, _); // adding authorized users etc. new Matches m; if null (s = dropMyPrefixOrNull(s)) null; if (matchX2("do you know ...|name ...", s, m)) { L<Cluster> found = clusters.searchForCluster($1); if (empty(found)) { topic = clusters.newCluster($1); ret "No I don't know " + $1; } topic = random(found); change(); ret (l(found) > 1 ? "I know multiple. " : "") + "You mean " + join(" = ", topic.synonyms) + "?"; } if (matchX2("he is ...|she is ...|it is ...|he's ...|she's ...|it's ...|they are ...", s, m)) { if (topic == null) ret "Who is?"; if (topic.synonyms.add($1)) { change(); ret "Aha. " + join(" = ", topic.synonyms); } else ret "Yup, I know"; } if "number of clusters" ret l_str(clusters.clusters); if (eqic(s, "help")) ret ltrim([[ I am a bot that knows synonyms. DB size: ]] + l(clusters.clusters) + [[ Stuff to say. @me do you know james brown? @me he is a singer @me name an activist @me number of clusters [Bot made by https://BotCompany.de] ]]).replace("@me", atSelf()); null; } } }
Began life as a copy of #1025290
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025304 |
Snippet name: | Clusters Bot [shortened, LIVE] |
Eternal ID of this version: | #1025304/13 |
Text MD5: | 9a8a489c534e5d24b25f7aff3e010b52 |
Transpilation MD5: | f6d0d844318338ac27de0126d45680c2 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-22 13:27:44 |
Source code size: | 1801 bytes / 62 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 343 / 24519 |
Version history: | 12 change(s) |
Referenced in: | #1025329 - Radio Bot [abandoned] #1025348 - NL Rules Bot [LIVE in Gazelle, copy of Katherine] #1025733 - Weight Change Bot [original demo, OK] |