Ejemplo n.º 1
0
            //check and ignore replieds
            $str_id = 1;
            echo $from_chatid . ":" . $update_id . ":" . $from . ": " . $text . "\n";
            $reply = b::reply_get($text, $from, $str_id, $pp = false, $custom);
            //GENERATE A REPLY TEXT BASED ON YOUR TRIGGER AND BAD WORDS, SEE/EDIT reply_get() ON src/classes.php
            if ($chat_type != "private") {
                if (strpos($text, $conf["trigger"]) === false and $pvt == true) {
                    i::fwrite_a($conf["replieds"], $update_id . "\r\n");
                    return false;
                }
                $reply = $from . " " . $reply;
            }
            echo "replying > {$reply}";
            $reply = urlencode($reply);
            //encode reply text to use on HTTP POST
            $reply_textbuffer = $reply;
            $reply = b::telegrambot_sendReply($from_chatid, $reply);
            //POST a reply to group/pvt
            //i::vd($reply); //enable for debuggin
            $httpcode = $reply["header"]["http_code"];
            if ($httpcode == 200 or $httpcode == 403) {
                if (isset($conf["debug_chatid"])) {
                    $replydebug = b::telegrambot_sendReply($conf["debug_chatid"], $from . " {$text} :: {$from_chattitle} :: " . $reply_textbuffer);
                    //send a reply to debug chatid too..
                }
                i::fwrite_a($conf["replieds"], $update_id . "\r\n");
                //if ok, stores it to avoid duplicates
            }
        }
    }
}