!7 static Map cmdToProgram; static L> voiceCommandLog; p { quietDB(); cmdToProgram = persistentTreeMap("Command to program"); voiceCommandLog = persistentList("Voice Command Log"); makeBot("Voice Actions."); } sS answer(S s) { new Matches m; voiceCommandLog.add(pair(s, now()); if "user said: *" { s = $1; } S a; try { a = answer2(s); } catch e { printStackTrace(e); a = str(e); } if (nempty(a)) infoBox_lower(a); ret a; } sS answer2(S s) { new Matches m; if "command * to program *" { cmdToProgram.put($1, $2); ret "OK"; } if "applause" { applause(); ret "Applause!"; } if "restart voice actions" { restartIn1(); ret "OK"; } if "voice log" { showLog(); ret "OK"; } S program = lookupByNLMatch(cmdToProgram, s); if (nempty(program)) { nohupJavax(program); ret "Running: " + snippetWithTitle(program); } null; } svoid showLog { showTable(map(cloneList(voiceCommandLog), func(Pair p) { litorderedmap("Command" := p.a, "Time" := formatDateAndTime(p.b)) }), "Voice Log"); }