$chat_id,
'text' => $text,
'parse_mode' => 'HTML'
];
if ($keyboard) {
$data['reply_markup'] = json_encode($keyboard);
}
$ch = curl_init($API.'/sendMessage');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
}
function mainKeyboard($chat_id){
$keyboard = [
'keyboard' => [
['๐ Batafsil ma\'lumot'],
['๐ Buyurtma berish']
],
'resize_keyboard' => true
];
sendMessage($chat_id, "Kerakli boโlimni tanlang ๐", $keyboard);
}
/* START */
if ($text == "/start") {
sendMessage(
$chat_id,
"๐ Assalomu alaykum!\n\nAsal Ari botiga xush kelibsiz.\n\nBizda toza va tabiiy asal mavjud.\nSifat kafolatlanadi โ
"
);
mainKeyboard($chat_id);
}
/* BATAFSIL MA'LUMOT */
elseif ($text == "๐ Batafsil ma'lumot") {
sendMessage(
$chat_id,
"๐ฏ Asal haqida batafsil maโlumot\n\nQuyidagi havolada oโqishingiz mumkin ๐\n\n๐ https://uz.wikipedia.org/wiki/Asal"
);
}
/* BUYURTMA */
elseif ($text == "๐ Buyurtma berish") {
sendMessage(
$chat_id,
"๐ Narxlar:\n\n๐ฏ 1 litr โ 100 000 soโm\n๐ฏ 0.5 litr โ 50 000 soโm\n\nTelefon raqamingizni yuboring ๐"
);
$keyboard = [
'keyboard' => [
[
[
'text' => '๐ Telefon raqamni yuborish',
'request_contact' => true
]
]
],
'resize_keyboard' => true,
'one_time_keyboard' => true
];
sendMessage($chat_id, "Tugmani bosing โฌ๏ธ", $keyboard);
}
/* TELEFON QABUL QILINDI */
elseif ($contact) {
sendMessage(
$chat_id,
"โ
Buyurtmangiz qabul qilindi!\n\nTez orada siz bilan bogโlanamiz.\nRahmat ๐"
);
mainKeyboard($chat_id);
}
echo "OK";