Warning: session_start(): open(/var/lib/php/sessions/sess_81mig37lh1mk4hkgehjbldue10, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!759
static new Map thesaurusMap;
p {
load("thesaurusMap");
}
synchronized answer {
if "add thesaurus2 * *" {
S key = m.unq(0), value = m.unq(1);
if (match(key, value))
ret "You nasty rascal, don't do the endless loop!";
thesaurusMap.put(key, value);
save("thesaurusMap");
ret "OK, saved! Thesaurus size now: " + l(thesaurusMap);
}
if "remove thesaurus2 *" {
S key = m.unq(0);
ret thesaurusMap.remove(key) != null ? "Removed." : "Not found...";
}
if "thesaurus2 size"
ret lstr(thesaurusMap);
if "list thesaurus2"
ret structure(thesaurusMap);
for (S key : keys(thesaurusMap))
if (match(key, s, m)) {
S a = askSelf(rewrite(thesaurusMap.get(key), m));
if (nempty(a)) {
getInvolvedBots().add(formatSnippetID(programID()));
ret a;
}
}
}
static S rewrite(S pattern, Matches m) {
for (int i = 0; i < l(m.m); i++)
m.m[i] = unquote(m.m[i]);
ret format(pattern, m.m);
}