abstract sclass DynTalkBot > DynDiscordHopper { switchable S myName = "Anonymous bot"; switchable S sliceID; transient bool useAGIBlueForDropPunctuation = true; start { dm_vmBus_onMessage_q('discordGuildJoin, voidfunc(Map map) { ret unless map.get('module) == module(); print("Got join"); onUserJoin(getLong userID(map), map); }); } // overridable void onUserJoin(long userID, O... _) {} S processSimplifiedLine(S s, O... _) { null; } @Override S answer(S input, Map map) { ret mapEachLine_tlft_nempties(input, s -> { ret processLine(s, map); }); } S processLine(S s, O... _) { s = preprocess(s, _); ret processSimplifiedLine(s, _); } S preprocess(S s, O... _) { if (discordBotID != 0) s = replace(s, discordAt(discordBotID), " " + myName + " "); s = dropPunctuation3_withAGIBlue(useAGIBlueForDropPunctuation, s); s = trim(simpleSpaces_noTok(s)); print("simplified >> " + quote(s)); ret s; } }