Yangi formatda davom etish uchun: https://uzfor.net/view.php?act=post&id=16007
Postga havola
STRaKER [83] [off]
Umid qilamanki foydasi tegadi
lug'at bot
lug'at bot
<?php include('vendor/autoload.php'); include('config.php'); use Telegram\Bot\Api; use Telegram\Bot\Actions; $telegram = new Api('api'); $result = $telegram -> getWebhookUpdates(); $text = $result["message"]["text"]; $chat_id = $result["message"]["chat"]["id"]; $user_id = $result["message"]["from"]["id"]; $key_haqida = [["Bot haqida"]]; $haqida = $telegram->replyKeyboardMarkup([ 'keyboard' => $key_haqida, 'resize_keyboard' => true, 'one_time_keyboard' => true ]); $telegram->sendChatAction([ 'chat_id' => $chat_id, 'action' => Actions::TYPING ]); if($text){ if ($text == "/start") { $reply = "Inglizcha so`zni kiriting men uni tarjimasini sizga jo`nataman ;)"; $telegram->sendMessage([ 'chat_id' => $chat_id, 'text' => $reply, 'reply_markup' => $haqida ]); }elseif ($text == "Bot haqida") { $reply = "Inglizcha-O`zbekcha lug`at. Dasturchi: Ahrorbek Abdullayev E-mail: ahrorbeksoft@mail.ru Telegram: @ahrorbeksoft"; $telegram->sendMessage([ 'chat_id' => $chat_id, 'text' => $reply ]); }else{ //boshlandi $text = txt($text); $soz = $word2[1]; $reply = "<b>".output($sozlar['word'])."</b> - <code>".output($sozlar['meaning'])."</code>"; } $telegram->sendMessage([ 'chat_id' => $chat_id, 'text' => $reply, 'reply_markup' => $haqida, 'parse_mode' => 'HTML' ]); }else{ $c_words = mysql_result(mysql_query("SELECT COUNT(*) FROM `en-uz` Where `word` Like '".input($text)."%'"), 0); if ($c_words > 1) { $klav[] = '- '.$sozlar['word'].' -'; } $reply = "Bundan so`zdan ".$c_words." ta topildi, quyidagilardan birini tanlang:"; if (count($klav) == 5) {$keyboard = [ [$klav[0]], [$klav[1]], [$klav[2]], [$klav[3]], [$klav[4]] ];} $reply_markup = $telegram->replyKeyboardMarkup([ 'keyboard' => $keyboard, 'resize_keyboard' => true, 'one_time_keyboard' => true ]); $telegram->sendMessage([ 'chat_id' => $chat_id, 'text' => $reply, 'reply_markup' => $reply_markup ]); }elseif($c_words == 1){ $reply = "<b>".output($sozlar['word'])."</b> - <code>".output($sozlar['meaning'])."</code>"; $telegram->sendMessage([ 'chat_id' => $chat_id, 'text' => $reply, 'reply_markup' => $haqida, 'parse_mode' => 'HTML' ]); } }else{ $reply = "Afsuski lug`atda bunday so`z mavjud emas!"; $telegram->sendMessage([ 'chat_id' => $chat_id, 'text' => $reply, 'reply_markup' => $haqida ]); } } } }else{ $telegram->sendMessage([ 'chat_id' => $chat_id, 'text' => "So`z noto`gri kiritildi!", 'reply_markup' => $haqida ]); } ?>