Warning: session_start(): open(/var/lib/php/sessions/sess_vrlqvqnt8re48p94addcuaikh5, 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
!7
!include #1007827 // Slack Bot
sbool doSlack = true;
extend SelectBot {
S name;
}
static SelectBot greetBot, timeBot;
p {
// DB start & migration
bootstrapConceptsFrom(#1007829);
db();
if (countConcepts(SelectBot) == 1)
cset(uniq(SelectBot), name := "greet");
greetBot = uniq(SelectBot, name := "greet");
timeBot = uniq(SelectBot, name := "time");
slackSpeed = 1000;
if (doSlack) initSlackBot();
dediSay("Back online!");
if (doSlack) slackBotLoop();
}
answer {
s = trim(s);
if (eq(s, "!data:greet")) ret struct(greetBot);
if (eq(s, "!data:time")) ret struct(timeBot);
if (startsWithWord(s, "!greet", m)) {
greetBot.put($1, true); ret "ok"; }
if (startsWithWord(s, "!nogreet", m)) {
greetBot.put($1, false); ret "ok"; }
if (startsWithWord(s, "!time", m)) {
timeBot.put($1, true); ret "ok"; }
if (startsWithWord(s, "!notime", m)) {
timeBot.put($1, false); ret "ok"; }
// general
if (eq(s, "!reload")) {
actionsAfterPost.add(f restart);
ret "krasser reload";
}
if (eq(s, "!source")) ret progLink();
if (eq(s, "!help")) ret botAutoHelp();
if (eq(s, "!debug")) ret greetBot.lastMatch;
// match on bots
if (isTrue(greetBot.get(s)))
ret s + " => hi!";
if (isTrue(timeBot.get(s)))
ret s + " => It is " + hmsWithColons();
}