Uses 911K of libraries. Click here for Pure Java version (20801L/111K).
!7 cmodule ChatBotFrontend > DynChatBotFrontend { Set<S> scriptRefs = syncSet(); transient L<virtual CruddieScript> scripts; start-thread { while (dm_booting()) sleepSeconds(0.1); loadScripts(); } void loadScripts { new L<virtual CruddieScript> scripts; for (S ref : scriptRefs) pcall { LS l = splitAtSlash(ref); if (l(l) != 3) continue with print("Can't load script: " + ref); S mod = dm_require(first(l) + "/" + second(l)); Class c = dm_getClassInModuleRealm(mod, "main$" + last(l)); if (c == null) continue with print("Couldn't find class: " + ref); O o = nu(c); forwardSwappableFunctionsToObject(o, module(), 'setBotName, 'getBotName); scripts.add(o); print("Got script: " + o); } this.scripts = scripts; } @Override S answer_other(S s) null { fOr (virtual CruddieScript script : scripts) pcall { try S a = (S) call(script, 'answer, s); } } // API void addScript(S moduleLibID, S shortClassName) { if (scriptRefs.add(addPrefix("#", moduleLibID) + "/" + assertIdentifier(shortClassName))) { change(); loadScripts(); } } }
Began life as a copy of #1027602
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027665 |
Snippet name: | Chat Bot Frontend v3 [with scripts] |
Eternal ID of this version: | #1027665/12 |
Text MD5: | c48218e566e0ad082cddc97f76e64a66 |
Transpilation MD5: | 72564f638b65addf48879780e314d6a8 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-30 00:22:45 |
Source code size: | 1218 bytes / 43 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 192 / 437 |
Version history: | 11 change(s) |
Referenced in: | [show references] |