Nevermind, markov sentences will be precompiled

This commit is contained in:
Mattia Mascarello 2021-10-05 21:48:36 +02:00 committed by GitHub
parent 0545a07d5f
commit 134a0a5467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -295,13 +295,7 @@ if ($DATA["message"]["from"]["is_bot"]) {
$t = $DATA["message"]["text"]; $t = $DATA["message"]["text"];
$uid = $DATA["message"]["from"]["id"]; $uid = $DATA["message"]["from"]["id"];
/*
Feed the markov generator
*/
file_put_contents("markovdata.txt",trim($t)."\n",FILE_APPEND);
/*
Is markov overweight? remove lines
*/
beg: beg:
switch ($DATA["message"]["chat"]["id"]) { switch ($DATA["message"]["chat"]["id"]) {
@ -428,11 +422,11 @@ switch ($DATA["message"]["chat"]["id"]) {
$url = $GLOBALS["config"]["lgbt"]["APIs"]["tpdne"] . "?v=" . time(); $url = $GLOBALS["config"]["lgbt"]["APIs"]["tpdne"] . "?v=" . time();
API("sendChatAction", ["chat_id" => $DATA["message"]["chat"]["id"], "action" => "upload_photo"]); API("sendChatAction", ["chat_id" => $DATA["message"]["chat"]["id"], "action" => "upload_photo"]);
API("sendPhoto", ["chat_id" => $DATA["message"]["chat"]["id"], "photo" => $url, "reply_to_message_id" => $DATA["message"]["message_id"]]); API("sendPhoto", ["chat_id" => $DATA["message"]["chat"]["id"], "photo" => $url, "reply_to_message_id" => $DATA["message"]["message_id"]]);
} elseif ($t==".ai" || explode(" ", $t)[0] == ".ai") { } elseif ($t==".ai") {
if (!moduleOn(".ai", $DATA["message"]["chat"]["id"], $DATA, true)) break; if (!moduleOn(".ai", $DATA["message"]["chat"]["id"], $DATA, true)) break;
require("markov.php"); $items = explode("##",file_get_contents("markovdata.txt"));
$n = (int) explode(" ", $t)[1]; $a = $items[array_rand($items)];
API("sendMessage", ["chat_id" => $DATA["message"]["chat"]["id"], "text" => markovT($n?:$GLOBALS["config"]["lgbt"]["markovdefault"])]); API("sendMessage", ["chat_id" => $DATA["message"]["chat"]["id"], "text" => $a]);
} elseif ($t == ".rave" || explode(" ", $t)[0] == ".rave") { } elseif ($t == ".rave" || explode(" ", $t)[0] == ".rave") {
if (!moduleOn(".rave", $DATA["message"]["chat"]["id"], $DATA, true)) break; if (!moduleOn(".rave", $DATA["message"]["chat"]["id"], $DATA, true)) break;
$ms = explode("\n", $t, 3)[1] ?: explode(" ", $t, 2)[1]; $ms = explode("\n", $t, 3)[1] ?: explode(" ", $t, 2)[1];