<?php
ob_start();
$API_KEY = "5051368650:AAHsXuy8HToavoTi3kNtYvCVu3b51yCzfXo";
$site = "";
define("API_KEY",$API_KEY);
function bot($method,$str=[]){
$http_build_query = http_build_query($str);
$api = "https://api.telegram.org/bot".API_KEY."/".$method."?$http_build_query";
$http_build_query = file_get_contents($api);
return json_decode($http_build_query);
}
$update = json_decode(file_get_contents("php://input"));
$message = $update->message;
$id = $message->from->id;
$chat_id = $message->chat->id;
$text = $message->text;
$message_id = $message->message_id;
if($text == "/adminpan"){
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"$stta ",
"reply_markup"=>json_encode([
"resize_keyboard"=>true,
"keyboard"=>[
[["text"=>"اذاعة بالتوجية"],["text"=>"اذاعة"]],
[["text"=>"معرفة عدد المشتركين"]],
]])
]);
}
$user = $update->message->from->username;
$from_id = $message->from->id;
$first_name = $message->from->first_name;
$type = $update->message->chat->type;
$message_id = $message->message_id;
$ook = file_get_contents("ok.txt");
$pirvate = explode("\n",file_get_contents("pirvate.txt"));
$forward = $update->message->forward_from;
$Subscribers = count($pirvate)-1;
$backhome = file_get_contents("agza.txt");
$backsound = file_get_contents("soundas.txt");
include('quranpages.php');
include('qurana_arbaaa.php');
$json = json_decode(file_get_contents("save.txt"),true);
$getjson = json_decode(file_get_contents("save.txt"));
$user = $getjson->$id;
$save = $user->save;
$page = $user->page;
$part = $user->part;
$startsounds = array(
/*"ختمات الأرباع",*/
"ختمات الأوجه",
/*"ختمات السور",*/
" ♻️ القائمة الرئيسة",
//"ختمات الأحزاب",
);
$startsoundsafter = array(
/*"gitmat_al_arbaa",*/
"gitmat_al_auguh",
/*"gitmat_al_sour",*/
/*"gitmat_al_ahzaab"*/
);
$writesave = str_replace($startsounds, $startsoundsafter, $text);
//الباحث النصي
$write = array(
"ابحث عن آية",
"تفسير آية - الميسر",
"تفسير آية - الجلالين",
"شرح آية باللغة الإنجليزية",
" ♻️ القائمة الرئيسة",
);
$writeafter = array(
"search",
"tafser2",
"tafser1",
"english"
);
$writemessage = array(
"حسنا ، أرسل ما تذكره من الآية ليتم البحث عنها",
"حسنا ، أرسل ما تذكره من الآية ليتم تفسيرها -تفسير الميسر-",
"حسنا ، أرسل ما تذكره من الآية ليتم تفسيرها -تفسير الجلالين-",
"حسنا ، أرسل ما تذكره من الآية ليتم شرحها باللغة الإنجليزية",
);
$writesave = str_replace($write, $writeafter, $text);
$writemessage = str_replace($write, $writemessage, $text);
//الباحث الصوتي
$sound = array(
"ختمة قالون/ الشيخ محمود خليل الحصري",
"ختمة ورش/ الشيخ محمود خليل الحصري",
"ختمة حفص/ الشيخ محمود خليل الحصري",
);
$soundafter = array(
"Al_husari",
"Al_husari_warsh",
"Al_husari_Hafs",
);
$soundafterv2 = array(
"Al_husari",
"Al_husari_warsh",
"Al_husari_Hafs",
);
$soundsave = str_replace($sound, $soundafter,$text);
// Auguh
$auguh_details = array(
"الوجه رقم ١",
"الوجه رقم ٢",
);
$auguh_detailsafter = array(
"page001",
"page002",
);
$auguh_detailssave = str_replace($auguh_details, $auguh_detailsafter, $text);
//
$parts = array(
"الجزء رقم ١ ( الأوجه من ١ إلى ٢١ )",
"الجزء رقم ٢ ( الأوجه من ٢٢ إلى ٤١ )",
);
$partsafter = array(
"part1",
"part2",
);
$partssave = str_replace($parts, $partsafter, $text);
//start
if($text == "/start"){
$json ["$id"]["save"] = "start";
file_put_contents("save.txt",json_encode($json));
foreach($sound as $ckey){
$keyboard[] = [$ckey];
}
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"
حياك الله في بوت ختمات القران الكريم
".$site,
"reply_to_message_id"=>$message_id,
"reply_markup"=>json_encode([
'keyboard'=>$keyboard
])
]);
return;
}
if($text == "رجوع 🔙" or $text == "♻️ القائمة الرئيسة"){
foreach($sound as $ckey){
$keyboard[] = [$ckey];
}
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"
اختر القارئ بالرواية التى تريد
".$site,
"reply_to_message_id"=>$message_id,
"reply_markup"=>json_encode([
'keyboard'=>$keyboard
])
]);
return;
}
if(in_array($text,$write)){
$json ["$id"]["save"] = "$writesave";
file_put_contents("save.txt",json_encode($json));
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>$writemessage,
"reply_to_message_id"=>$message_id,
]);
return;
}
if(in_array($save,$writeafter)){
$get = json_decode(file_get_contents("https://api-quran.cf/quransql/index.php?text=".urlencode($text)."&type=".$save))->result;
$count = count($get);
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"تم العثور على $count من النتائج",
"reply_to_message_id"=>$message_id,
]);
if($count > 10)
$l = 10;
else
$l = $count;
for( $i=0; $i <= $l; $i++){
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>$get[$i],
]);
}
return;
}
if(in_array($text,$sound)){
$json ["$id"]["save"] = "$soundsave";
file_put_contents("save.txt",json_encode($json));
/*foreach($parts_auguh as $key){
$keyboard[] = [$key];
}*/
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"تم إختيار القارئ ، قم الآن بكتابة اسم السورة أو قم بالإختيار من الكيبورد في الاسفل..",
"reply_to_message_id"=>$message_id,
"reply_markup"=>json_encode([
'keyboard'=>[
[['text'=>'رجوع 🔙']],
[['text'=>'الجزء رقم ١ ( الأوجه من ١ إلى ٢١ )']],
[['text'=>'الجزء رقم ٢ ( الأوجه من ٢٢ إلى ٤١ )']],
[['text'=>'الجزء رقم ٣ ( الأوجه من ٤٢ إلى ٦١ )']],
[['text'=>'الجزء رقم ٤ ( الأوجه من ٦٢ إلى ٨١ )']],
[['text'=>'الجزء رقم ٥ ( الأوجه من ٨٢ إلى ١٠١ )']],
[['text'=>'الجزء رقم ٦ ( الأوجه من ١٠٢ إلى ١٢١ )']],
[['text'=>'الجزء رقم ٧ ( الأوجه من ١٢٢ إلى ١٤١ )']],
[['text'=>'الجزء رقم ٨ ( الأوجه من ١٤٢ إلى ١٦١ )']],
[['text'=>'الجزء رقم ٩ ( الأوجه من ١٦٢ إلى ١٨١ )']],
[['text'=>'الجزء رقم ١٠ ( الأوجه من ١٨٢ إلى ٢٠١ )']],
[['text'=>'الجزء رقم ١١ ( الأوجه من ٢٠٢ إلى ٢٢١ )']],
[['text'=>'الجزء رقم ١٢ ( الأوجه من ٢٢٢ إلى ٢٤١ )']],
[['text'=>'الجزء رقم ١٣ ( الأوجه من ٢٤٢ إلى ٢٦١ )']],
[['text'=>'الجزء رقم ١٤ ( الأوجه من ٢٦٢ إلى ٢٨١ )']],
[['text'=>'الجزء رقم ١٥ ( الأوجه من ٢٨٢ إلى ٣٠١ )']],
[['text'=>'الجزء رقم ١٦ ( الأوجه من ٣٠٢ إلى ٣٢١ )']],
[['text'=>'الجزء رقم ١٧ ( الأوجه من ٣٢٢ إلى ٣٤١ )']],
[['text'=>'الجزء رقم ١٨ ( الأوجه من ٣٤٢ إلى ٣٦١ )']],
[['text'=>'الجزء رقم ١٩ ( الأوجه من ٣٦٢ إلى ٣٨١ )']],
[['text'=>'الجزء رقم ٢٠ ( الأوجه من ٣٨٢ إلى ٤٠١ )']],
[['text'=>'الجزء رقم ٢١ ( الأوجه من ٤٠٢ إلى ٤٢١ )']],
[['text'=>'الجزء رقم ٢٢ ( الأوجه من ٤٢٢ إلى ٤٤١ )']],
[['text'=>'الجزء رقم ٢٣ ( الأوجه من ٤٤٢ إلى ٤٦١ )']],
[['text'=>'الجزء رقم ٢٤ ( الأوجه من ٤٦٢ إلى ٤٨١ )']],
[['text'=>'الجزء رقم ٢٥ ( الأوجه من ٤٨٢ إلى ٥٠١ )']],
[['text'=>'الجزء رقم ٢٦ ( الأوجه من ٥٠٢ إلى ٥٢١ )']],
[['text'=>'الجزء رقم ٢٧ ( الأوجه من ٥٢٢ إلى ٥٤١ )']],
[['text'=>'الجزء رقم ٢٨ ( الأوجه من ٥٤٢ إلى ٥٦١ )']],
[['text'=>'الجزء رقم ٢٩ ( الأوجه من ٥٦٢ إلى ٥٨١ )']],
[['text'=>'الجزء رقم ٣٠ ( الأوجه من ٥٨٢ إلى ٦٠٤ )']],
[['text'=>'رجوع 🔙']],
],
'resize_keyboard'=>true,
])
]);
return;
}
/*
if(in_array($text,$sound) and in_array($part, $partsafter)){
$json ["$id"]["save"] = "$soundsave";
file_put_contents("save.txt",json_encode($json));
$json ["$id"]["save"] = "$partssave";
file_put_contents("save.txt",json_encode($json));
$get = json_decode(file_get_contents("http://telegramlibrary.aba.vg/curl/handlersergi.php?part=".$part));
foreach($get->data as $key){
$keyboard[] = [$key];
}
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"تم إختيار القارئ ، قم الآن بكتابة اسم السورة أو قم بالإختيار من الكيبورد في الاسفل..",
"reply_to_message_id"=>$message_id,
"reply_markup"=>json_encode([
'keyboard'=>$keyboard,
])
]);
return;
}
*/
if($text == "🔙 رجـوع"){
/*foreach($parts_auguh as $key){
$keyboard[] = [$key];
}*/
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>
"
✅ تم إختيار القارئ
الأن قم بالإختيار الجزء الذي يحتوي على الوجه الذي تريد
",
"reply_to_message_id"=>$message_id,
"reply_markup"=>json_encode([
'keyboard'=>[
[['text'=>'رجوع 🔙']],
[['text'=>'الجزء رقم ١ ( الأوجه من ١ إلى ٢١ )']],
[['text'=>'الجزء رقم ٢ ( الأوجه من ٢٢ إلى ٤١ )']],
[['text'=>'الجزء رقم ٣ ( الأوجه من ٤٢ إلى ٦١ )']],
[['text'=>'الجزء رقم ٤ ( الأوجه من ٦٢ إلى ٨١ )']],
[['text'=>'الجزء رقم ٥ ( الأوجه من ٨٢ إلى ١٠١ )']],
[['text'=>'الجزء رقم ٦ ( الأوجه من ١٠٢ إلى ١٢١ )']],
[['text'=>'الجزء رقم ٧ ( الأوجه من ١٢٢ إلى ١٤١ )']],
[['text'=>'الجزء رقم ٨ ( الأوجه من ١٤٢ إلى ١٦١ )']],
[['text'=>'الجزء رقم ٩ ( الأوجه من ١٦٢ إلى ١٨١ )']],
[['text'=>'الجزء رقم ١٠ ( الأوجه من ١٨٢ إلى ٢٠١ )']],
[['text'=>'الجزء رقم ١١ ( الأوجه من ٢٠٢ إلى ٢٢١ )']],
[['text'=>'الجزء رقم ١٢ ( الأوجه من ٢٢٢ إلى ٢٤١ )']],
[['text'=>'الجزء رقم ١٣ ( الأوجه من ٢٤٢ إلى ٢٦١ )']],
[['text'=>'الجزء رقم ١٤ ( الأوجه من ٢٦٢ إلى ٢٨١ )']],
[['text'=>'الجزء رقم ١٥ ( الأوجه من ٢٨٢ إلى ٣٠١ )']],
[['text'=>'الجزء رقم ١٦ ( الأوجه من ٣٠٢ إلى ٣٢١ )']],
[['text'=>'الجزء رقم ١٧ ( الأوجه من ٣٢٢ إلى ٣٤١ )']],
[['text'=>'الجزء رقم ١٨ ( الأوجه من ٣٤٢ إلى ٣٦١ )']],
[['text'=>'الجزء رقم ١٩ ( الأوجه من ٣٦٢ إلى ٣٨١ )']],
[['text'=>'الجزء رقم ٢٠ ( الأوجه من ٣٨٢ إلى ٤٠١ )']],
[['text'=>'الجزء رقم ٢١ ( الأوجه من ٤٠٢ إلى ٤٢١ )']],
[['text'=>'الجزء رقم ٢٢ ( الأوجه من ٤٢٢ إلى ٤٤١ )']],
[['text'=>'الجزء رقم ٢٣ ( الأوجه من ٤٤٢ إلى ٤٦١ )']],
[['text'=>'الجزء رقم ٢٤ ( الأوجه من ٤٦٢ إلى ٤٨١ )']],
[['text'=>'الجزء رقم ٢٥ ( الأوجه من ٤٨٢ إلى ٥٠١ )']],
[['text'=>'الجزء رقم ٢٦ ( الأوجه من ٥٠٢ إلى ٥٢١ )']],
[['text'=>'الجزء رقم ٢٧ ( الأوجه من ٥٢٢ إلى ٥٤١ )']],
[['text'=>'الجزء رقم ٢٨ ( الأوجه من ٥٤٢ إلى ٥٦١ )']],
[['text'=>'الجزء رقم ٢٩ ( الأوجه من ٥٦٢ إلى ٥٨١ )']],
[['text'=>'الجزء رقم ٣٠ ( الأوجه من ٥٨٢ إلى ٦٠٤ )']],
[['text'=>'رجوع 🔙']],
],
'resize_keyboard'=>true
])
]);
return;
}
if(in_array($text, $auguh_details)){
$json ["$id"]["page"] = "$auguh_detailssave";
file_put_contents("save.txt",json_encode($json));
bot('sendMessage',[
"chat_id" => $chat_id,
"text" => "ZakiOli",
"reply_to_message_id" => $message_id,
"reply_markup" => json_encode([
'keyboard'=>[
[['text'=>'back']],
[['text'=>'Send audio'],['text'=>'Send audio tafseer']],
[['text'=>'Send Pdf'],['text'=>'Send Photo']],
[['text'=>'Send Tafseer']],
],
'resize_keyboard'=>true
])
]);
return;
}
if(in_array($page, $auguh_detailsafter) and $text == "Send audio" and in_array($save, $soundafter)){
$get = json_decode(file_get_contents("https://telegramlibrary.aba.vg/curl/handler.php?souraEnglish=".urlencode($page)."&readernameEngilsh=".$save));
bot('sendaudio',[
'chat_id' => $chat_id,
'audio' => $get->url,
'caption' =>
"🕋 ".$get->soura."\n🎙 ".$get->readername."\n",
"reply_to_message_id"=>$message_id,
]);
return;
}
?>