BIX
Kod · PHP61 qator
while (true) {

    $updates = $MadelineProto->get_updates(['offset' =>'-1', 'limit' => 10, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout

    \danog\MadelineProto\Logger::log($updates);

    foreach ($updates as $update) {

        $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id

        switch ($update['update']['_']) {

            case 'updateNewMessage':

                if (isset($update['update']['message']['out']) && $update['update']['message']['out']) {

                    continue;

                }

                $res = json_encode($update, JSON_PRETTY_PRINT);

                if ($res == '') {

                    $res = var_export($update, true);

                }

                $text=$update['update']['message']['message'];

                if(mb_stripos($text,'Salom','XAYRLI KUN','KIM BOR')!==false or mb_stripos($text,'salom')!==false){

                    try {

                        $MadelineProto->messages->sendMessage([

                            'peer' => $update['update']['message']['from_id'], 

                            'message' => "SALOM","ASSALOMU ALAYKUM","VA ALEYKUM ASSALOM QALAYSIZ O'ZI",

                            'reply_to_msg_id' => $update['update']['message']['id'],

                            'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);

                    

                    } catch (\danog\MadelineProto\RPCErrorException $e) {

                    $MadelineProto->messages->sendMessage(['peer' => '@ZEHNLI_NO2_BOT', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);

                        

                    }

                }

        }

    }

}

1 daqiqa 17 soniyadan keyin yozdi:
DO'STLAR SHU JAVOBNI RANDOM QILIB SOZLASH QANDAY BO'LADI JAVOB UCHUN OLDINDAN KATTA RAHMAT
2 daqiqa 29 soniyadan keyin yozdi:
O'ZIM YOZMOQCHI EDIM O'XSHAMADI