sclass ELPost { S text; int suggestionIndex; // Which suggestion was taken? S suggester; S chatTime; } static L scanEventLogForPosts(S progID, S dialogName) { ret scanEventLogForPosts(getProgramFile(progID, dialogName)); } // dialogDir can also be the log file static L scanEventLogForPosts(File dialogDir) { if (dialogDir == null) null; L l = scanLog_safeUnstructure(fileFromDir(dialogDir, "event.log")); new L data; for i over l: pcall { L a = l.get(i), prev = get(l, i-1); if (firstIs(a, "Posting")) { Map map = cast get(a, 2); S text = getString(map, "Text").trim(); if (eq(text, "!delete")) { removeLast(data); continue; } new ELPost post; post.text = text; post.chatTime = getString(a, 1); pcall { if (prev != null && firstIs(prev, "Suggestion chosen")) { Map m = getMap(prev, 2); S suggestion = getString(m, "Suggestion"); if (eq(suggestion, post.text)) { post.suggestionIndex = toInt(get(m, "Row")); post.suggester = getString(m, "Suggester"); } } } data.add(post); } } ret data; }