<?php
ob_start();
$API_KEY = "5051368650:AAGyZfWfsUuax5JtGhuAD476d4nLbK9pFMA";
$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;
$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;
$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",
/*"Abdulbasit_abdulsamad",*/
);
$soundsave = str_replace($sound, $soundafter,$text);
/*[['text'=>'الباحث النصي']],*/
//start
if($text == "/start"){
$json ["$id"]["save"] = "start";
file_put_contents("save.txt",json_encode($json));
/*bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"
حياك الله في بوت ختمات القران الكريم
".$site,
"reply_to_message_id"=>$message_id,
"reply_markup"=>json_encode([
'keyboard'=>[
[['text'=>'صوتيات القران الكريم']],
],
'resize_keyboard'=>true
]),
]);
return;*/
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($text == "صوتيات القران الكريم"){
foreach($startsounds as $key){
$keyboard[] = [$key];
}
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"
حياك الله في بوت ختمات القران الكريم
".$site,
"reply_to_message_id"=>$message_id,
"reply_markup"=>json_encode([
'keyboard'=>$keyboard
])
]);
return;
}*/
//أوامر الباحث النصي
/*if($text == "الباحث النصي"){
foreach($write as $key){
$keyboard[] = [$key];
}
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;
}
//Pages search ckey
/*
if($text == "/pages"){
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,$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'=>'الجزء رقم ٢٨ ']],*/
[['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($text == "🔙 رجـوع"){
/*foreach($parts_auguh as $key){
$keyboard[] = [$key];
}*/
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>
"
✅ تم إختيار القارئ \n
الأن قم بالإختيار الجزء الذي يحتوي على الوجه الذي تريد
",
"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'=>'الجزء التاسع و العشرون']],
],
'resize_keyboard'=>true
])
]);
return;
}
if(in_array($save,$soundafter)){
$get = json_decode(file_get_contents("https://telegramlibrary.aba.vg/curl/handler.php?soura=".urlencode($text)."&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;
}
// End
/*if($text == 'back' and $backsound == 'on'){
foreach($startsounds as $key){
$keyboard[] = [$key];
}
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"
حياك الله في خدمة الباحث القرآني
خدمة الباحث القرآني على الانترنت :
".$site,
"reply_to_message_id"=>$message_id,
"reply_markup"=>json_encode([
'keyboard'=>$keyboard
])
]);
return;
}
if($text == 'back' and $backhome == 'on'){
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($message){
bot("sendMessage",[
"chat_id"=>$chat_id,
"text"=>"
لم أتمكن من فهم هذا الأمر ، يرجى إرسال
/start
",
"reply_to_message_id"=>$message_id,
]);
}
?>