sclass AI_DatesBot > AttractorBot { Long now; public void run { say("I can resolve dates for you"); } // CONFIG class Attractor1 > Attractor { int month, day; public bool matches(S s) { new Matches m; if (match("* of *", s, m)) { month = indexOfIC(englishMonthNames(), $2)+1; if (month < 1) false; day = ai_indexToNr($1); ret day > 0; } else if (match("* * of *", s, m)) { if (!eqicOneOf($2, "th", "rd", "nd", "st")) false; month = parseIntOpt($1); if (month < 1) false; day = or0(ai_indexToNr($3)); ret day > 0; } false; } public void run { say(localYear(nowOr(now)) + "/" + formatInt(month, 2) + "/" + formatInt(day, 2)); } } *() { standardAttractors(new Attractor1); } }