[
[["text" => "π€ Bot yasash"], ["text" => " hosting sotib olish"]],
[["text" => "π° Hisobni to'ldirish"], ["text" => "π€ Kabinet"]]
],
"resize_keyboard" => true
];
if ($chat_id == ADMIN_ID) {
$keyboard["keyboard"][] = [["text" => "βοΈ Admin panel"]];
}
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "Assalomu alaykum, $first_name!\n\n㪠MEGA KINOM botiga xush kelibsiz. Kerakli bo'limni tanlang:",
"parse_mode" => "HTML",
"reply_markup" => json_encode($keyboard)
]);
}
// Admin panel
elseif ($chat_id == ADMIN_ID && $text == "βοΈ Admin panel") {
$keyboard = [
"keyboard" => [
[["text" => "π Statistika"], ["text" => "π΅ Narxlarni belgilash"]],
[["text" => "π Asosiy menyu"]]
],
"resize_keyboard" => true
];
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "π Admin paneliga xush kelibsiz!",
"parse_mode" => "HTML",
"reply_markup" => json_encode($keyboard)
]);
}
elseif ($text == "π Asosiy menyu") {
file_put_contents($state_file, "");
$keyboard = [
"keyboard" => [
[["text" => "π€ Bot yasash"], ["text" => " hosting sotib olish"]],
[["text" => "π° Hisobni to'ldirish"], ["text" => "π€ Kabinet"]]
],
"resize_keyboard" => true
];
if ($chat_id == ADMIN_ID) $keyboard["keyboard"][] = [["text" => "βοΈ Admin panel"]];
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "Asosiy menyudasiz:",
"reply_markup" => json_encode($keyboard)
]);
}
// Statistika
elseif ($chat_id == ADMIN_ID && $text == "π Statistika") {
$stats = getDB("stats");
$u_count = count(getDB("users"));
$txt = "π BOT STATISTIKASI\n\n" .
"π₯ Foydalanuvchilar: {$u_count}\n" .
"π Buyurtmalar: " . ($stats['orders'] ?? 7) . "\n" .
"β³ Kutilayotgan toβlovlar: " . ($stats['pending'] ?? 0) . "\n" .
"π Jarayondagi buyurtmalar: " . ($stats['process'] ?? 0) . "\n" .
"π° Tasdiqlangan toβlovlar: " . ($stats['confirmed_sum'] ?? '23 000') . " soβm\n" .
"β Telegram Stars tushumi: " . ($stats['stars'] ?? 0) . " Stars\n" .
"β
Bajarilgan buyurtmalar: " . ($stats['completed'] ?? 2) . "\n" .
"β Bekor qilingan buyurtmalar: " . ($stats['canceled'] ?? 5) . "\n\n" .
"π DAROMAD HISOBOTI\n\n" .
"π΅ Jami tushum: " . ($stats['total_income'] ?? '23 000') . " soβm\n" .
"β Stars orqali tushum: 0 soβm\n" .
"πΈ Jami xarajat: " . ($stats['total_expense'] ?? '25 000') . " soβm\n" .
"π’ Sof daromad: " . ($stats['net_profit'] ?? '-2 000') . " soβm\n" .
"π
Bugungi tushum: " . ($stats['today_income'] ?? '23 000') . " soβm\n" .
"π Oylik tushum: " . ($stats['month_income'] ?? '23 000') . " soβm";
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => $txt,
"parse_mode" => "HTML"
]);
}
// Narxlarni belgilash
elseif ($chat_id == ADMIN_ID && $text == "π΅ Narxlarni belgilash") {
file_put_contents($state_file, "set_price");
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "Yangi kino bot narxini kiriting (masalan: 15000):"
]);
}
elseif ($chat_id == ADMIN_ID && $state == "set_price") {
file_put_contents($db_dir . "bot_price.txt", $text);
file_put_contents($state_file, "");
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "β
Bot narxi muvaffaqiyatli $text so'm qilib belgilandi!",
"parse_mode" => "HTML"
]);
}
// Hosting sotib olish
elseif ($text == " hosting sotib olish" || $text == "Hosting sotib olish") {
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "Tez kunda qo'shamiz!\nHosting xizmati hozirda ishlab chiqilmoqda.",
"parse_mode" => "HTML"
]);
}
// Bot yasash
elseif ($text == "π€ Bot yasash") {
$prices = file_exists($db_dir . "bot_price.txt") ? file_get_contents($db_dir . "bot_price.txt") : "10000";
$keyboard = [
"inline_keyboard" => [
[["text" => "π¬ Kino boti (Narxi: {$prices} so'm)", "callback_data" => "create_kino"]],
[["text" => "π± Virtual simkarta boti (Tez kunda)", "callback_data" => "create_sim"]]
]
];
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "Qaysi turdagi botni yaratmoqchisiz? Quyidagilardan birini tanlang:",
"reply_markup" => json_encode($keyboard)
]);
}
// Hisobni to'ldirish
elseif ($text == "π° Hisobni to'ldirish") {
file_put_contents($state_file, "waiting_for_check");
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "π³ Hisobni to'ldirish uchun pulni karta raqamimizga o'tkazing va to'lov chekini (rasm yoki skrinshot) shu yerga yuboring:"
]);
}
// Chek yuborilganda
elseif ($state == "waiting_for_check" && isset($message["photo"])) {
file_put_contents($state_file, "");
$photo_id = end($message["photo"])["file_id"];
$keyboard = [
"inline_keyboard" => [
[
["text" => "β
Tasdiqlash", "callback_data" => "pay_yes_{$chat_id}"],
["text" => "β Bekor qilish", "callback_data" => "pay_no_{$chat_id}"]
]
]
];
bot("sendPhoto", [
"chat_id" => ADMIN_ID,
"photo" => $photo_id,
"caption" => "π Yangi to'lov cheki keldi!\n\nFoydalanuvchi: {$first_name}\nID: {$chat_id}",
"parse_mode" => "HTML",
"reply_markup" => json_encode($keyboard)
]);
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "β
Chekingiz adminga yuborildi! Tekshirilgach hisobingiz to'ldiriladi."
]);
}
// Token yuborish holati
elseif ($state == "waiting_for_token") {
file_put_contents($state_file, "");
bot("sendMessage", [
"chat_id" => $chat_id,
"text" => "β
Tabriklayman! Kino botingiz muvaffaqiyatli yaratildi va ishga tushirildi.",
"parse_mode" => "HTML"
]);
}
}
// Callback tugmalar
elseif (isset($update["callback_query"])) {
$callback = $update["callback_query"];
$chat_id = $callback["message"]["chat"]["id"];
$data = $callback["data"];
$message_id = $callback["message"]["message_id"];
if ($data == "create_kino") {
$prices = file_exists($db_dir . "bot_price.txt") ? file_get_contents($db_dir . "bot_price.txt") : "10000";
$keyboard = [
"inline_keyboard" => [
[["text" => "β
Tasdiqlash va sotib olish", "callback_data" => "confirm_kino"]],
[["text" => "Β« Orqaga", "callback_data" => "back_to_menu"]]
]
];
bot("editMessageText", [
"chat_id" => $chat_id,
"message_id" => $message_id,
"text" => "π¬ Kino boti\n\nπ Tavsif: To'liq avtomatlashgan kino boti.\nπ° Narxi: {$prices} so'm\n\nYaratishni tasdiqlaysizmi?",
"parse_mode" => "HTML",
"reply_markup" => json_encode($keyboard)
]);
}
elseif ($data == "create_sim") {
bot("answerCallbackQuery", [
"callback_query_id" => $callback["id"],
"text" => "Virtual simkarta boti tez kunda qo'shamiz, hozir kino botini qo'llashingiz mumkin!",
"show_alert" => true
]);
}
elseif ($data == "confirm_kino") {
file_put_contents($db_dir . "state_" . $chat_id . ".txt", "waiting_for_token");
bot("editMessageText", [
"chat_id" => $chat_id,
"message_id" => $message_id,
"text" => "Iltimos, @BotFather dan olgan Bot Tokeningizni shu yerga matn ko'rinishida yuboring:",
"parse_mode" => "HTML"
]);
}
elseif (strpos($data, "pay_yes_") === 0) {
$u_id = str_replace("pay_yes_", "", $data);
bot("sendMessage", [
"chat_id" => $u_id,
"text" => "π To'lovingiz admin tomonidan tasdiqlandi va hisobingiz to'ldirildi!"
]);
bot("editMessageCaption", [
"chat_id" => $chat_id,
"message_id" => $message_id,
"caption" => $callback["message"]["caption"] . "\n\nβ
Holat: Tasdiqlandi",
"parse_mode" => "HTML"
]);
}
elseif (strpos($data, "pay_no_") === 0) {
$u_id = str_replace("pay_no_", "", $data);
bot("sendMessage", [
"chat_id" => $u_id,
"text" => "β Afsuski, to'lov chekingiz rad etildi. Qayta tekshirib yuboring."
]);
bot("editMessageCaption", [
"chat_id" => $chat_id,
"message_id" => $message_id,
"caption" => $callback["message"]["caption"] . "\n\nβ Holat: Rad etildi",
"parse_mode" => "HTML"
]);
}
}
?>