BIX
  1. while (true) {
  2. $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
  3. \danog\MadelineProto\Logger::log($updates);
  4. foreach ($updates as $update) {
  5. $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id
  6. switch ($update['update']['_']) {
  7. case 'updateNewMessage':
  8. if (isset($update['update']['message']['out']) && $update['update']['message']['out']) {
  9. continue;
  10. }
  11. $res = json_encode($update, JSON_PRETTY_PRINT);
  12. if ($res == '') {
  13. $res = var_export($update, true);
  14. }
  15. $text=$update['update']['message']['message'];
  16. if(mb_stripos($text,'Salom','XAYRLI KUN','KIM BOR')!==false or mb_stripos($text,'salom')!==false){
  17. try {
  18. $MadelineProto->messages->sendMessage([
  19. 'peer' => $update['update']['message']['from_id'],
  20. 'message' => "SALOM","ASSALOMU ALAYKUM","VA ALEYKUM ASSALOM QALAYSIZ O'ZI",
  21. 'reply_to_msg_id' => $update['update']['message']['id'],
  22. 'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);
  23.  
  24. } catch (\danog\MadelineProto\RPCErrorException $e) {
  25. $MadelineProto->messages->sendMessage(['peer' => '@ZEHNLI_NO2_BOT', 'message' => $e->getCode().': '.$e->getMessage().PHP_EOL.$e->getTraceAsString()]);
  26.  
  27. }
  28. }
  29. }
  30. }
  31. }

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