!7 cmodule Monkey > DynDiscordHopper { S myName = "Monkey"; start { dm_vmBus_onMessage_q('discordGuildJoin, voidfunc(Map map) { ret unless map.get('module) == module(); postInChannel(preferredChannelID, "I sense a joiner"); }); dm_vmBus_onMessage_q('discordGuildLeave, voidfunc(Map map) { ret unless map.get('module) == module(); postInChannel(preferredChannelID, "I sense a leaver"); }); } @Override S answer(S input, Map map) { ret mapEachLine_tlft_nempties(input, s -> { new Matches m; if "what's your name" ret myName; if (swic_trim(s, "!power ", m)) { ret or2(joinWithSpacedPlus(ai_powerWordsExpand(agiBlue_parsedPowerWords(), tok_splitAtPlus(m.rest()))), "No results"); } try answer super.answer(s, map); //try answer agiBlue_getAnswer(s); try answer agiBlue_lookup(s, 'answer, 'is, 'means); if (hasEllipsesInTheMiddle(s)) try answer random(listMinusElementIC(s, collect q(jsonDecodeList(loadPageWithParams("http://agi.blue/bot/allPagesContainingRegexp", q := "^" + ellipsisToDotPlusRegexp(s) + "$", max := 10))))); S x = startsWithEndsWith_getRest_trim(s, "...", "..."); if (nempty(x)) try answer random(listMinusElementIC(s, collect q(jsonDecodeList(loadPageWithParams("http://agi.blue/bot/allPagesContaining", q := x, max := 10))))); if (ewic_trim(s, "...", m)) try answer random(listMinusElementIC(s, collect q(jsonDecodeList(loadPageWithParams("http://agi.blue/bot/allPagesStartingWith", q := m.rest(), max := 10))))); null; }); } }