<?php
ob_start();



$API_KEY="6024902638:AAGFhrnV7NSzPOOCfo-cnnLMzTVGD_e4dxc";


  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ معلومات البوت *************//

$Bot_Name = "بوت تجريبي";	
$Bot_Token="6226072474:AAFFnW8U_wUDPqky1Vrr1zcVz4qJrqAUfaY";
$Bot_Channel = "allbotsnew";
$Bot_Group = "";
$Bot_Communication_Bot = "";
$Bot_Description = "";
$Bot_Note = "";

  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ معلومات المطور *************//

$Devloper_Name = "Akeel Mohammed";
$Devloper_Display_Name = "aqeldev";

$Devloper_Telegram_ID = 6190086496;
$Devloper_Telegram_Account = "Bo530";
$Devloper_Telegram_Channel = "aqeldev";
$Devloper_Telegram_Group = "";
$Devloper_PhoneNumber = "";
$Devloper_WebSite = "";
$Devloper_Description = "";
$Devloper_Note = "";

  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ معلومات المدراء *************//
$AdminID = 6190086496;

$AdminsList = array("00000","00000","00000","$AdminID","0000");
  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ الحسابات والقنوات الاجبارية *************//
$FollowCh = "allbotsnew";
$FollowCh2 = "allbotsnew";



$Obligatory_Channels = array("allbotsnew","allbotsnew");


  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************  *************//

$DevUser = "aqeldev";
$DevName = "المطور Aqel Dev 💻";


$DevloperID = 6190086496;
$Start_ID = 11111111111;


 ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ روابط *************//

$Joinchat ="https://t.me/";


  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************  *************//
// رسائل الترحيب


$DescribesStartBot = "
`- اهلا وسهلا بك في البوت`
` ،` 
";

$DescribesAdminStartBot = "اهلا بكم يا مطوري اكيل";


$DescribesStartForDevloperBot = "اهلا بك عزيزي المطور";

$DescribesStartJoinChatBot = "⛔️| عذرا عزيزي
◾| البوت لا يعمل الا اذا قمت بالاشتراك بقناة البوت
◾| وعند الغاء الاشتراك فان البوت سوف يتوقف .";



  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ مسميات الازرار *************//
// مسميات ازرار
$Str_Refresh = "🔄تحديث" ;
$Str_Back = "↪️ رجـوع";
$Str_Home ="🗂الرئيسية";
$Str_Cancel = "❌الغاء";
$Str_Search ="🔎بحث عن هاتف";



  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ مسميات اوامر الازرار  *************//
// مسميات اوامر data

$Str_Data_BlockUser = "BlockUser" ;

$Str_Data_UnBlockUser = "UnBlockUser" ;

$Str_Data_ClearBlockList ="ClearBlockList" ;

$Str_Data_User_Home ="User_Home" ;

$Str_Data_AdminList_Home ="AdminList_Home" ;

$Str_Data_Cancel = "Cancel" ;

$Str_Data_Back = "Back" ;

$Str_Data_AlarmForNewUser = "AlarmForNewUser" ;

$Str_Data_UsersList = "UsersList" ;

$Str_Data_StartUserMsg = "StartUserMsg" ;
$Str_Data_BotInfo = "BotInfo" ;
$Str_Data_MagToAll = "MagToAll" ;
$Str_Data_BlockList= "BlockList" ;


$Str_Data_Admins_Section= "Admins_Section" ;

$Str_Data_Add_Admin= "Add_Admin" ;
$Str_Data_Remove_Admin= "Remove_Admin" ;
$Str_Data_Admin_List= "Admin_List" ;

$Str_Data_Users_Section= "Users_Section" ;

// 
   ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ مسميات المجلدات *************//

$Str_Administration_Folder = "Administration" ;


$Str_MangersFolder = "Mangers" ;
$Str_Users_Folder = "Users" ;


$Str_Events_Folder = "Events" ;

$Str_Log_Folder = "Log" ;




  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ مسارات الملفات *************//




$Str_Bot_Control_Path = "Administration/Bot_Control.json"  ;

$Str_AdminFile_Path = "Mangers/Admin.txt"  ;

$Str_BotUpdateLog_File_Path = "Events/BotUpdateLog.txt"  ;

$Str_MainSettingFile_Path ="MainSetting.json" ;

$Str_Bot_Users_Json_File_Path = "Users/Bot_Users_Json.json"  ;

$Str_UserInfo_File_Path = "Users/UserInfo.json"  ;

$Str_Administration_Bot_Info_File_Path = "Administration/Bot_Info.json"  ;
$Str_Bot_Update_Log_File_Path = "Log/Update_Log.json"  ;

$Str_MainLog_File_Path = "Log/Main_Log.json"  ;




  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ مسميات الملفات *************//

$Str_AdminFile = "Admin.txt" ;

$Str_Commands_File_Name = "Commands" ;
$Str_Commands_User_File_Name = "Commands_User" ;



  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ خاص بتعريفات الجيسون *************//
	
	
$Str_Json_Opject_MainLog_Api_Name = "Api_Log" ;
$Str_Json_Opject_MainLog_Bot_Name = "Bot_Log" ;
$Str_Json_Opject_UserInfo_Info_Name = "Info" ;

$Str_Json_Opject_Bot_Control_Informtion_Name = "Informtion" ;


$Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name = "Bot_Information" ;
$Str_Json_Opject_Bot_Control_Informtion_Contact_Name = "Contact" ;

$Str_Json_Opject_Bot_Control_Setting_Name = "Setting" ;

$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name = "Main_Settings" ;

$Str_Json_Opject_Bot_Control_Setting_Devlopers_Settings_Name = "Devlopers_Settings" ;

$Str_Json_Opject_Bot_Control_Setting_Admins_Settings_Name = "Admins_Settings" ;

$Str_Json_Opject_Bot_Control_Setting_Users_Settings_Name = "Users_Settings" ;

$Str_Json_Opject_Bot_Control_Setting_Compulsory_Channels_Name = "Compulsory_Channels" ;
$Str_Json_Opject_Bot_Control_Setting_Compulsory_Channels_Channels_Info_Name = "Channels_Info" ;
$Str_Json_Opject_Bot_Control_Setting_Compulsory_Channels_Channels_List_Name = "Channels_List" ;


$Str_Json_Opject_Bot_Control_Setting_Identifications_Name = "Identifications" ;

$Str_Json_Opject_Bot_Control_Setting_Identifications_Messages_Name = "Identifications_Messages" ;
$Str_Json_Opject_Bot_Control_Setting_Identifications_Buttons_Name = "Identifications_Buttons" ;

$Str_Json_Opject_Bot_Control_Administration_Name = "Administration" ;
$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name = "Admins_Info" ;
$Str_Json_Opject_Bot_Control_Administration_Admins_Powers_Name = "Admins_Powers" ;

$Str_Json_Opject_Bot_Control_Administration_Admins_List_Name = "Admins_List" ;

$Str_Json_Opject_Bot_Control_Notes_Name = "Notes" ;

  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ عام *************//

$Str_None = "none"  ;




  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ بداية التنفيذ *************//


define('API_KEY', $API_KEY);


echo "https://api.telegram.org/bot" . API_KEY . "/setwebhook?url=" . $_SERVER['SERVER_NAME'] . "" . $_SERVER['SCRIPT_NAME'];



$bot = GetMe()->result;
$botid = $bot->id;
$botname = $bot->first_name;
$botusername = $bot->username;

$update = json_decode(file_get_contents('php://input'));

 

$update_id = $update->update_id;
$message = $update->message;
$message_id = $message->message_id;
$message_thread_id = $message->message_thread_id;
$date = $message->date;
$text = $message->text;
$new_chat_title = $message->new_chat_title;



$from_id = $message->from->id;
$user_id = $message->from->id;
$username = $update->message->from->username;
$userfristname = $message->from->first_name;
$userlastname = $message->from->last_name;
$name = $userfristname.' '.$userlastname;
$is_bot = $message->from->is_bot;
$language_code = $message->from->language_code;
$is_premium = $message->from->is_premium;
$chat_id = $message->chat->id;
$chat_type = $message->chat->type;
$title = $message->chat->title;
$is_forum = $message->chat->is_forum;
$emoji_status_custom_emoji_id = $message->chat->emoji_status_custom_emoji_id;
$bio = $message->chat->bio;
$description = $message->chat->description	;
$invite_link = $message->chat->invite_link	;
$linked_chat_id = $message->chat->linked_chat_id	;


$reply                = $message->reply_to_message;
$reply_id      =     $reply->from->id;
$reply_first_name      =     $reply->from->first_name;
$reply_user    = $reply->from->username;
$reply_message_id   = $reply->message_id;



$forward = $message->forward_from;
$forward_id      =     $forward->from->id;
$forward_first_name      =     $forward->from->first_name;
$forward_user    = $forward->from->username;




$inline = $message->reply_markup->inline_keyboard;
$entities = $message->entities;


$location   = $message->location;
$location_file_id   = $message->location->file_id;

$new_chat        = $message->new_chat_member;
$left_chat         = $message->left_chat_member;
$new_id            = $new_chat->id; 
$left_id              = $left_chat->id;
$left_name              = $left_chat->first_name;

$name_tag = "[$name](tg://user?id=$from_id)";
$name_reply = $message->reply_to_message->from->first_name;
$name_tag_reply =  "[$name_reply](tg://user?id=$reply_id)";

$data       = $update->callback_query->data;
$chat_id2   = $update->callback_query->message->chat->id;
$message_id2 = $update->callback_query->message->message_id;

#                   خاص بالضغط على الازرار الشفافة
if(isset($update->callback_query)){
$up = $update->callback_query;
$chat_id = $up->message->chat->id;
$from_id = $up->from->id;
$user_id = $up->from->id;    
$username = $up->from->username; 
$userfristname = $up->from->first_name;
$userlastname = $up->from->last_name;    
$name = $name = $userfristname.' '.$userlastname;    
$message_id = $up->message->message_id;
$mes_id = $up->inline_message_id; 
$data = $up->data;
}


if(isset($update->inline_query)){
$in = $update->inline_query;   
$chat_id = $in->chat->id;
$from_id = $in->from->id;
$user_id = $in->from->id;    
$username = $in->from->username; 
$userfristname = $in->from->first_name;
$userlastname = $in->from->last_name;    
$name = $name = $userfristname.' '.$userlastname;          
$text_inline = $in->query;
$mes_id = $in->inline_message_id; 
}

$time=time()+(3600 * 1);

CreateStartFolder();

file_put_contents("$Str_Bot_Update_Log_File_Path",json_encode($update)."\r\n",FILE_APPEND); 

$Str_AdminCommandsFile_Path = "Events/Admin/$from_id/$Str_Commands_File_Name"  ;



  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ اوامر المدراء والمستخدمين *************//
	
$V_Commands = file_get_contents($Str_AdminCommandsFile_Path);

if (IsAdmin($from_id)){
	mkdir("Events/Admin/$from_id");
if (!file_exists($Str_AdminCommandsFile_Path)) {    
    Put_In_Commands_File("no");    
}
} 


$V_Commands_User = file_get_contents("Events/User/$from_id/$Str_Commands_User_File_Name");

  



if (!file_exists("Events/User/$from_id/$Str_Commands_User_File_Name")) { 
    Put_In_Commands_User_File("no");    
}
 

/////////////////////


$AdminsListFromFile=explode("\n",file_get_contents("$Str_AdminFile_Path"));
$V_Admins_Count = count($AdminsListFromFile)-1;

if (!file_exists("$Str_AdminFile_Path")) {
   file_put_contents("$Str_AdminFile_Path",$Start_ID."\n",FILE_APPEND); 
}

/////////////////////






 ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ اوامر الجيسون *************//
	
	///////////////////// معلومات واعدادات البوت
	
	
	
	$V_Bot_Control = Create_Bot_Control_Json($V_Bot_Control);
	
	
	function Create_Bot_Control_Json($V_Bot_Control){
	
	 global $Str_Bot_Control_Path;
	
	
	global $Str_Json_Opject_Bot_Control_Informtion_Name ;


global $Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name  ;
global $Str_Json_Opject_Bot_Control_Informtion_Contact_Name  ;

global $Str_Json_Opject_Bot_Control_Setting_Name  ;

global $Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name ;

global $Str_Json_Opject_Bot_Control_Setting_Devlopers_Settings_Name ;

global $Str_Json_Opject_Bot_Control_Setting_Admins_Settings_Name  ;

global $Str_Json_Opject_Bot_Control_Setting_Users_Settings_Name  ;


global $Str_Json_Opject_Bot_Control_Setting_Compulsory_Channels_Name  ;
global $Str_Json_Opject_Bot_Control_Setting_Compulsory_Channels_Channels_Info_Name ;
global $Str_Json_Opject_Bot_Control_Setting_Compulsory_Channels_Channels_List_Name  ;


global $Str_Json_Opject_Bot_Control_Setting_Identifications_Name  ;

global $Str_Json_Opject_Bot_Control_Setting_Identifications_Messages_Name  ;
global $Str_Json_Opject_Bot_Control_Setting_Identifications_Buttons_Name  ;

global $Str_Json_Opject_Bot_Control_Administration_Name  ;
global $Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name ;
global $Str_Json_Opject_Bot_Control_Administration_Admins_Powers_Name  ;

global $Str_Json_Opject_Bot_Control_Administration_Admins_List_Name  ;

global $Str_Json_Opject_Bot_Control_Notes_Name  ;
	
		
		
			global $Bot_Name  ;
				global $Bot_Token  ;		
				global $Bot_Description  ;	
				global $Bot_Note  ;	
			global $Bot_Channel  ;
			
			
			
			global $DevloperID  ;
			
			
	
	global $DescribesStartBot  ;
	global $DescribesAdminStartBot  ;
	global $DescribesStartJoinChatBot  ;
	
	

         
 
      
  $Json =     json_decode(file_get_contents("$Str_Bot_Control_Path"),true);
if (!file_exists("$Str_Bot_Control_Path")) {
$Json[$Str_Json_Opject_Bot_Control_Informtion_Name][$Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name]["ID"]=1;
$Json[$Str_Json_Opject_Bot_Control_Informtion_Name][$Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name]["MasterID"]="-1";
$Json[$Str_Json_Opject_Bot_Control_Informtion_Name][$Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name]["Name"]="$Bot_Name";
$Json[$Str_Json_Opject_Bot_Control_Informtion_Name][$Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name]["Token"]="$Bot_Token";
$Json[$Str_Json_Opject_Bot_Control_Informtion_Name][$Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name]["Description"]="$Bot_Description";
$Json[$Str_Json_Opject_Bot_Control_Informtion_Name][$Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name]["Note"]="$Bot_Note";
$Json[$Str_Json_Opject_Bot_Control_Informtion_Name][$Str_Json_Opject_Bot_Control_Informtion_Bot_Information_Name]["Hosting_Url"]="https://connecttagye.com/Bots/Fld_Test/Test.php";

$Json[$Str_Json_Opject_Bot_Control_Informtion_Name][$Str_Json_Opject_Bot_Control_Informtion_Contact_Name]["Bot_Channel"]="$Bot_Channel";


$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name]["Active"]="✅";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name]["Compulsory_Channels"]="✅";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name]["ShowStatisticInSetting"]="✅";

$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name]["StopForMaintenance"]="❎";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name]["StopForMaintenanceToDate"]="2023-05-30";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name][$Str_Json_Opject_Bot_Control_Setting_Devlopers_Settings_Name]["ShowDevAlert_NewUserJoin"]="✅";

$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name][$Str_Json_Opject_Bot_Control_Setting_Admins_Settings_Name]["ShowAdminAlert_NewUserJoin"]="✅";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name][$Str_Json_Opject_Bot_Control_Setting_Admins_Settings_Name]["Active_Admins"]="✅";

$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name][$Str_Json_Opject_Bot_Control_Setting_Users_Settings_Name]["CanNewUserJoin"]="✅";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Main_Settings_Name][$Str_Json_Opject_Bot_Control_Setting_Users_Settings_Name]["StopBlockUsers"]="✅";



$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["ID"]=1;
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["Name"]="akeel";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["UserName"]="Devloper";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["Telegram_ID"]="$DevloperID";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["Adjective"]="Devloper";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["Description"]="";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["Active"]="✅";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["ToDate"]="2023-12-30";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["CrateDate"]="Devloper";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["CrateAdminID"]="-1";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name]["Note"]="";

$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Powers_Name]["Type"]="1";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Powers_Name]["Name"]="Admin";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Info_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_Powers_Name]["Active"]="✅";



$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_List_Name]=[['id' => $DevloperID, 'UserName' => "Akeel", 'name' =>"ak"],['id' => 444, 'UserName' => "ibrah", 'name' =>"in"]];





$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Messages_Name]["StartUserMsg"]="$DescribesStartBot";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Messages_Name]["StartAdmin_Msg"]="$DescribesAdminStartBot";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Messages_Name]["StartSubscribeChannel_Msg"]="$DescribesStartJoinChatBot";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Messages_Name]["Maintenance_Msg"]="عذرا البوت متوقف لصيانة";

$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Buttons_Name]["Back"]="العودة";
$Json[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Name][$Str_Json_Opject_Bot_Control_Setting_Identifications_Buttons_Name]["Home"]="الرئيسية";
file_put_contents("$Str_Bot_Control_Path", json_encode($Json));
}


         
       return $Json;     

 
}
	
	
	
	
	
	
	
	
	
	
	
	
	
	///////////////////// العمليات في البوت
	
	
	
	
	
	
	
	
	
	 $V_MainLog = Record_MainLog_Json($V_MainLog);
 
     
function Record_MainLog_Json($V_MainLog){
	
	  global $Str_MainLog_File_Path;
	    global $Str_Json_Opject_MainLog_Api_Name;
		  global $Str_Json_Opject_MainLog_Bot_Name;


global $botid;
global $botname;
global $botusername;

global $update_id;

		  global $date;

	   global $message_id;
   global $message_id2;
   global $message_thread_id;
   global $new_chat_title;
      global $text;

            global $chat_id;
	            global $chat_id2;		
			
			       global $chat_type;
				       global $title;
   global $is_forum;
						       global $emoji_status_custom_emoji_id;
							       global $bio;
								   global $description;
								   global $invite_link;
								   global $linked_chat_id;
				   
			   global $from_id;
   		    global $userfristname;
			 global $userlastname;
   global $name;
   global $language_code;
   global $is_premium;
      global $is_bot;
	  
	  
	 global $reply_id;
	  global $reply_first_name;
	 global $reply_user;
	 global $reply_message_id;
	 
	 	 global $forward_id;
	  global $forward_first_name;
	 global $forward_user;
	 
	 

   
         global $new_id;
	        global $left_id;
			      global $left_name;
   
      global $name_tag;
	        global $name_reply;
			      global $name_tag_reply;


   
    $Str_Json_Opject_Bot_Name = "Bot";
	   $Str_Json_Opject_Update_Name = "Update";
   $Str_Json_Opject_User_Name = "User";
    $Str_Json_Opject_Chat_Name = "Chat";
	 $Str_Json_Opject_Message_Name = "message";
		 $Str_Json_Opject_Reply_Name = "Reply";	
 $Str_Json_Opject_Forward_Name = "Forward";	
      
$Json =  json_decode(file_get_contents("$Str_MainLog_File_Path"),true);





$Json[$Str_Json_Opject_Bot_Name]["botid"]=$botid;
$Json[$Str_Json_Opject_Bot_Name]["botname"]=$botname;
$Json[$Str_Json_Opject_Bot_Name]["botusername"]=$botusername;

$Json[$Str_Json_Opject_MainLog_Api_Name][$Str_Json_Opject_Update_Name]["update_id"]=$update_id;



$Json[$Str_Json_Opject_User_Name]["from_id"]=$from_id;

$Json[$Str_Json_Opject_User_Name]["userfristname"]="$userfristname";
$Json[$Str_Json_Opject_User_Name]["userlastname"]="$userlastname";
$Json[$Str_Json_Opject_User_Name]["is_bot"]=$is_bot;



$Json[$Str_Json_Opject_User_Name]["language_code"]="$language_code";
$Json[$Str_Json_Opject_User_Name]["is_premium"]=$is_premium;

$Json[$Str_Json_Opject_Chat_Name]["chatid"]=$chat_id;
$Json[$Str_Json_Opject_Chat_Name]["chatid2"]=$chat_id2;
$Json[$Str_Json_Opject_Chat_Name]["chat_type"]="$chat_type";
$Json[$Str_Json_Opject_Chat_Name]["is_forum"]=$is_forum;
$Json[$Str_Json_Opject_Chat_Name]["title"]="$title";
$Json[$Str_Json_Opject_Chat_Name]["emoji_status_custom_emoji_id"]="$emoji_status_custom_emoji_id";
$Json[$Str_Json_Opject_Chat_Name]["bio"]="$bio";
$Json[$Str_Json_Opject_Chat_Name]["description"]="$description";
$Json[$Str_Json_Opject_Chat_Name]["invite_link"]="$invite_link";
$Json[$Str_Json_Opject_Chat_Name]["linked_chat_id"]="$linked_chat_id";
$Json[$Str_Json_Opject_Message_Name]["message_id"]=$message_id2;
$Json[$Str_Json_Opject_Message_Name]["message_id2"]=$message_id;
$Json[$Str_Json_Opject_Message_Name]["message_thread_id"]=$message_thread_id;
$Json[$Str_Json_Opject_Message_Name]["text"]="$text";
$Json[$Str_Json_Opject_Message_Name]["new_chat_title"]="$new_chat_title";
$Json[$Str_Json_Opject_Message_Name]["date"]=$date;

$Json[$Str_Json_Opject_Message_Name][$Str_Json_Opject_Reply_Name]["reply_id"]=$reply_id;
$Json[$Str_Json_Opject_Message_Name][$Str_Json_Opject_Reply_Name]["reply_first_name"]=$reply_first_name;
$Json[$Str_Json_Opject_Message_Name][$Str_Json_Opject_Reply_Name]["reply_user"]=$reply_user;
$Json[$Str_Json_Opject_Message_Name][$Str_Json_Opject_Reply_Name]["reply_message_id"]=$reply_message_id;

$Json[$Str_Json_Opject_Message_Name][$Str_Json_Opject_Forward_Name]["forward_id"]=$forward_id;
$Json[$Str_Json_Opject_Message_Name][$Str_Json_Opject_Forward_Name]["forward_first_name"]=$forward_first_name;
$Json[$Str_Json_Opject_Message_Name][$Str_Json_Opject_Forward_Name]["forward_user"]=$forward_user;

$Json[$Str_Json_Opject_MainLog_Bot_Name]["name"]="$name";
$Json[$Str_Json_Opject_MainLog_Bot_Name]["name_tag"]="$name_tag";

$Json[$Str_Json_Opject_MainLog_Bot_Name]["name_tag_reply"]="$name_tag_reply";
$Json[$Str_Json_Opject_MainLog_Bot_Name]["name_reply"]="$name_reply";

$Json["NewUser"]["new_id"]="$new_id";

$Json["LeftUser"]["left_id"]="$left_id";
$Json["LeftUser"]["left_name"]="$left_name";


file_put_contents("$Str_MainLog_File_Path", json_encode($Json)."\r\n",FILE_APPEND);  

         
       return $Json;     

 
}
	
	
		///////////////////// معلومات المستخدمسن
	

 
     
function Add_UserInfo_Json($V_UserInfo){
	
	  global $Str_UserInfo_File_Path;
	    global $Str_Json_Opject_UserInfo_Info_Name;



		  global $date;


   

            global $chat_id;
			       global $chat_type;
				  
							       global $bio;
								   global $description;
							
				   
			   global $from_id;
   		    global $userfristname;
			 global $userlastname;
   global $name;
    global $is_bot;  
   
   global $language_code;
   global $is_premium;
   
 


      
$Json =  json_decode(file_get_contents("$Str_UserInfo_File_Path"),true);
$Json[$Str_Json_Opject_UserInfo_Info_Name]["Id"]=111;
$Json[$Str_Json_Opject_UserInfo_Info_Name]["from_id"]=$from_id;

$Json[$Str_Json_Opject_UserInfo_Info_Name]["userfristname"]="$userfristname";
$Json[$Str_Json_Opject_UserInfo_Info_Name]["userlastname"]="$userlastname";
$Json[$Str_Json_Opject_UserInfo_Info_Name]["name"]="$name";
$Json[$Str_Json_Opject_UserInfo_Info_Name]["is_bot"]=$is_bot;

$Json[$Str_Json_Opject_UserInfo_Info_Name]["language_code"]="$language_code";
$Json[$Str_Json_Opject_UserInfo_Info_Name]["is_premium"]=$is_premium;


$Json[$Str_Json_Opject_UserInfo_Info_Name]["chatid"]=$chat_id;
$Json[$Str_Json_Opject_UserInfo_Info_Name]["chat_type"]="$chat_type";

$Json[$Str_Json_Opject_UserInfo_Info_Name]["bio"]="$bio";
$Json[$Str_Json_Opject_UserInfo_Info_Name]["description"]="$description";
$Json[$Str_Json_Opject_UserInfo_Info_Name]["date"]=$date;
$Json[$Str_Json_Opject_UserInfo_Info_Name]["Note"]="";



file_put_contents("$Str_UserInfo_File_Path", json_encode($Json)."\r\n",FILE_APPEND);  

         
       return $Json;     

 
}
	
	///////////////////// العمليات في البوت

//$SearchLog = json_decode(file_get_contents("SearchLog.json"),true);
$SearchLog = explode("\n", json_decode(file_get_contents("SearchLog.json"),true));
if (!file_exists("SearchLog.json")) {
#	$put = [];
$SearchLog["info"]["chatid"]="$chat_id";
$SearchLog["info"]["text"]="$text";

$SearchLog["info"]["from_id"]="$from_id";
$SearchLog["info"]["user_id"]="$user_id";
$SearchLog["info"]["username"]="$username";
$SearchLog["info"]["name"]="$name";

file_put_contents("SearchLog.json", json_encode($SearchLog)."\r\n");


}

$SearchLog["info"]["chatid"]="$chat_id";
$SearchLog["info"]["text"]="$text";

$SearchLog["info"]["from_id"]="$from_id";
$SearchLog["info"]["user_id"]="$user_id";
$SearchLog["info"]["username"]="$username";
$SearchLog["info"]["name"]="$name";
file_put_contents("SearchLog.json", json_encode($SearchLog)."\r\n",FILE_APPEND);



$Setting = json_decode(file_get_contents("BotSetting.json"),true);
if (!file_exists("BotSetting.json")) {
#	$put = [];
$Setting["info"]["st_ch_bots"]="$DevUser";
$Setting["info"]["id_channel"]="$FollowCh";

$Setting["info"]["link_channel"]="$FollowCh";
$Setting["info"]["id_channel2"]="$FollowCh2";
$Setting["info"]["link_channel2"]="$FollowCh2";
$Setting["info"]["user_bot"]="$DevUser";

file_put_contents("BotSetting.json", json_encode($Setting));
}



$st_ch_bots=$Setting["info"]["st_ch_bots"];
$id_ch_sudo1=$Setting["info"]["id_channel"];
$link_ch_sudo1=$Setting["info"]["link_channel"];
$id_ch_sudo2=$Setting["info"]["id_channel2"];
$link_ch_sudo2=$Setting["info"]["link_channel2"];
$user_bot_sudo=$Setting["info"]["user_bot"];


 
 $MainSetting = CreateJsonSetting($MainSetting);
 
     
function CreateJsonSetting($MainSetting){
	
	  global $DescribesStartBot;
	  
	 global $Str_MainSettingFile_Path;
	
	$Str_JsonField_Setting_Name = "informtion"  ;
         
 
      
    $Setting3 =     json_decode(file_get_contents("$Str_MainSettingFile_Path"),true);
if (!file_exists("$Str_MainSettingFile_Path")) {
#	$put = [];
$Setting3[$Str_JsonField_Setting_Name]["StartUserMsg"]="$DescribesStartBot";
$Setting3[$Str_JsonField_Setting_Name]["AlarmForNewUser"]="✅";
$Setting3[$Str_JsonField_Setting_Name]["d6"]="❎";



file_put_contents("$Str_MainSettingFile_Path", json_encode($Setting3));
}

//$Setting2 = $Setting3;
         
       return $Setting3;     

 
}




 $BotInfo_Json = CreateJson_BotInfo($BotInfo_Json);
 
     
function CreateJson_BotInfo($BotInfo_Json){
         
  global $Str_Administration_Bot_Info_File_Path;
      
    $Json = json_decode(file_get_contents("$Str_Administration_Bot_Info_File_Path"),true);
    
if (!file_exists("$Str_Administration_Bot_Info_File_Path")) {
#	$put = [];
$Json["informtion"]["ID"]="1";
$Json["informtion"]["Name"]="بوت تجريبي";
$Json["informtion"]["Describe"]="التواصل مع الجميع";
$Json["informtion"]["Admins"]["ID"][] ="0";

file_put_contents("$Str_Administration_Bot_Info_File_Path", json_encode($Json));
}


         
       return $Json;     

 
}

$Bot_Users_Json = Create_Json_Bot_Users($Bot_Users_Json);

function Create_Json_Bot_Users($Bot_Users_Json){
         
  global $Str_Bot_Users_Json_File_Path;
    global $DevloperID;
      
    $Json = json_decode(file_get_contents("$Str_Bot_Users_Json_File_Path"),true);
    
if (!file_exists("$Str_Bot_Users_Json_File_Path")) {

$Json["Users"][]="$DevloperID";
$Json["BlockUser"]=null;
$Json["UnBlockUser"]=null;
file_put_contents("$Str_Bot_Users_Json_File_Path", json_encode($Json));


}


         
       return $Json;     

 
}


$V_AlarmForNewUser = $MainSetting["informtion"]["$Str_Data_AlarmForNewUser"];

$V_DescribesStartUserMsg = $MainSetting["informtion"]["$Str_Data_StartUserMsg"];


$V_Managers = $V_Bot_Control[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_List_Name];
$V_Managers_Count = count($V_Managers);
if($V_Managers_Count<=0){
$V_Managers_Count="1";
}

$V_Users = $Bot_Users_Json["Users"];
$V_Users_Count = count($V_Users);
if($V_Users_Count<=0){
$V_Users_Count="1";
}


$V_BlockUsers = $Bot_Users_Json["BlockUser"];
$V_BlockUser_Count = count($V_BlockUsers);
if($V_BlockUser_Count<=0){
$V_BlockUser_Count="لايوجد محظورين";
}


if ($update && !in_array($chat_id, $V_Users)) {

    		 $V_UserInfo = Add_UserInfo_Json($V_UserInfo);
		Put_In_Json_NewUser_File("$chat_id");
	
  bot("sendmessage",[
"chat_id"=>$DevloperID,
"text"=>"- دخل شخص إلى البوت 🚶‍♂
[....$name](tg://user?id=$from_id) 
- ايديه $from_id 🆔
- معرفة : $username
---------
عدد اعضاء بوتك هو : $V_Users_Count
",
'disable_web_page_preview'=>'true',
'parse_mode'=>"markdown",
]);
  
}


if($message  and in_array($from_id,$V_BlockUsers)){
bot('sendMessage',[
'chat_id'=>$chat_id,
'text'=>"❌ لا تستطيع استخدام البوت كونك محضور ❌
",
]);

bot('forwardMessage',[
'chat_id'=>$DevloperID,
'from_chat_id'=>$chat_id,
 'message_id'=>$update->message->message_id,
'text'=>$text,
]);





return false;




}


/////////////////////

if($text == "/start" &&  !IsAdmin($chat_id)){
   
  if (!IsJoinToObligatory_Channels($chat_id)){
    SendMessage($chat_id,"اشترك ضربوا ك");
    
  }
  
$stuts = GetMember($API_KEY,$id_ch_sudo1,$from_id);
if($stuts=="no"){
bot('sendMessage',[
'chat_id'=>$chat_id,
'reply_to_message_id'=>$message_id,
'text'=>"
⚠️  عذراً عزيزي 
⚙  يجب عليك الاشتراك في قنوات البوت أولا
📮  اشترك ثم ارسل /start ⬇️
◾| وعند الغاء الاشتراك فان البوت سوف يتوقف .

",
'disable_web_page_preview'=>true,
'parse_mode'=>"markdown",
'reply_markup'=>json_encode([
'inline_keyboard'=>[
[['text'=>" اضغط للاشتراك في القناة ", 'url'=>"$Joinchat$link_ch_sudo1"]],

]
])
]);
return false;
    
}else{

    bot('sendMessage',[
'chat_id'=>$chat_id,
'text'=>"`- اهلا بك يا 👋🏻؛ `[$name](tg://user?id=$chat_id) ،

$V_DescribesStartUserMsg

قم بإرسال عنوان الايبي للحصول على معلوماته .

`﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎`

[• اضغط هنا وتابعنا ، ♡](t.me/$FollowCh)",
'parse_mode'=>"MarkDown",
'disable_web_page_preview'=>true,
        'reply_markup'=>json_encode([
            'inline_keyboard'=>[
[['text'=>" $DevName",'url'=>"https://t.me/$DevUser"]],
[['text'=>"$Str_Refresh",'callback_data'=>'ei']],
]
])
]);
  
  if ($V_AlarmForNewUser == "✅"){
    NoticeToDevloper("قام بارسال ام سارت");   
  }

}




}else if ($text == "/start"  && IsAdmin($chat_id) ){
    
  bot('sendMessage',[
'chat_id'=>$chat_id,
'text'=>"$DescribesAdminStartBot",
'parse_mode'=>"MarkDown",
'disable_web_page_preview'=>true,
        'reply_markup'=>json_encode([
            'inline_keyboard'=>[
[['text'=>" $DevName",'url'=>"https://t.me/$DevUser"]],
]
])
]);  





}
 
 
if($message->reply_to_message->forward_from->id and $chat_id == $DevloperID){
	

    bot('sendMessage',[
       'chat_id'=>$message->reply_to_message->forward_from->id,
        'text'=>$text,
    ]);
    bot('sendmessage',[ 
       'chat_id'=>$DevloperID,
        'text'=>"
تم ارسال الرساله
",
]);

}   

if ($text == "/Dev" && $chat_id == $DevloperID ) {
	

	bot('sendmessage',[
	'chat_id'=>$chat_id,
	'text'=>"اهلا بك مطور البوت ",
        'parse_mode'=>'MarkDown',
        	'reply_markup'=>json_encode([
	'resize_keyboard'=>true,
	'keyboard'=>[
	[['text'=>"⚙ انـشـاء webhook"],['text'=>"ℹ️ مـعـلـومـات الـتـوكـن"]],
	[['text'=>"❌ حـذف webhook"]]
	]
	])
	]);
    }

if ($text == "/Settings" && IsManager($chat_id) ) {
	
	AdminList();
	

}elseif ($text == "/Settings" && !IsManager($chat_id) )
{
  
    NoticeToDevloper(" يحاول الدخول الى الاعدادات ");   
}


if ($text != "/start"){

$Api = json_decode(file_get_contents("http://ip-api.com/json/$text"), true);

$query = $Api["query"];
$status = $Api["status"];
$country = $Api["country"];

$countryCode = $Api["countryCode"];

$city = $Api["city"];

$region = $Api["region"];
$regionName = $Api["regionName"];
$zip = $Api["zip"];
$lat = $Api["lat"];
$lon = $Api["lon"];
$timezone = $Api["timezone"];
$isp = $Api["isp"];
$org = $Api["org"];
$as = $Api["as"];
$enn = encrypt($country);



		bot('sendmessage',[
'chat_id'=>$chat_id,
'text'=>"

🔖| عنوان الايبي : $query
🌏| الدولة : $country
🏷| كود الدولة: $countryCode
🏙| المدينة :  $city 
🌐| كود النطاق : $region
⚙| اسم النطاق : $regionName
⚙| zip : $zip
⚙| lat : $lat
⚙| lon : $lon
🕛| المنطقة الزمنية : $timezone
📲| مزود الخدمة : $isp
🗺| عنوان المزود : $org
⚙| as : $as

$enn
",
'parse_mode'=>"Markdown",
'reply_to_message_id'=>$message->message_id,
]);




//$Apiccc = json_decode(file_get_contents("https://connecttagye.com/Bots/Fld_GetMyIp/appp.php"), true);

// $asfasf = $Apiccc["application"];
 
 
  

 //$chcc = curl_init();
 //curl_setopt($chcc, CURLOPT_POST, false);
// curl_setopt($chcc, CURLOPT_URL, "http://82.114.179.9:10014/cellernamedetector_folder/Cellernamedecector_API_DLL.dll/api/GetMyInfo");
 //curl_setopt($chcc, CURLOPT_RETURNTRANSFER, true);
  //  curl_setopt($curlhh, CURLOPT_HTTPHEADER, array(
 //     'Content-Type: application/json;charset=utf-8',
	//      'Accept: */*',  
	//       'Accept-Encoding: gzip, deflate, br',  
	//	         'User-Agent: bottt',  
	//	        'Connection: keep-alive',  
	  
	  
	  
 //  ));
// $api_response_json = curl_exec($chcc);
 //curl_close($chcc);
 //convert json to PHP array for further process
// $api_response_arr = json_decode($api_response_json);
 

 
// $yyyy = $api_response_arr["application"];
 
 

// if($api_response_arr['respond'] == true ){
    //code for success here
	
	//		bot('sendmessage',[

 //}else{

 //}
 
 


 //$get_data = callAPI('GET', "http://82.114.179.9:10014/cellernamedetector_folder/Cellernamedecector_API_DLL.dll/api/GetMyInfo", false);
//$response = json_decode($get_data, true);
//$errors = $response['response']['errors'];
//$data = $response['response']['data'][0];




//$assss = $response["application"];





//$decryptedPayload = JavaPHPCompatibleEncryption::decrypt($key, $encrypted);

 //GetMyTelegramInfo();
}


function callAPI($method, $url, $data){
   $curlhh = curl_init();
   switch ($method){
      case "POST":
         curl_setopt($curlhh, CURLOPT_POST, 1);
         if ($data)
            curl_setopt($curlhh, CURLOPT_POSTFIELDS, $data);
         break;
      case "PUT":
         curl_setopt($curlhh, CURLOPT_CUSTOMREQUEST, "PUT");
         if ($data)
            curl_setopt($curlhh, CURLOPT_POSTFIELDS, $data);			 					
         break;
      default:
         if ($data)
            $url = sprintf("%s?%s", $url, http_build_query($data));
   }
   // OPTIONS:
   curl_setopt($curlhh, CURLOPT_URL, $url);
   curl_setopt($curlhh, CURLOPT_HTTPHEADER, array(
      'APIKEY: 111111111111111111111',
      'Content-Type: application/json',
   ));
   curl_setopt($curlhh, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($curlhh, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
   // EXECUTE:
   $result = curl_exec($curlhh);
   if(!$result){die("Connection Failure");}
   curl_close($curlhh);
   return $result;
}

function decrypt($tex){
    return @openssl_decrypt($tex,"AES-256-CFB1", 1 );}
function encrypt($a){
    return @openssl_encrypt($a,"AES-256-CFB1", 1 );}


class JavaPHPCompatibleEncryption {
 
    private static $OPENSSL_CIPHER_NAME = "aes-128-cbc"; //Name of OpenSSL Cipher 
    private static $CIPHER_KEY_LEN = 16; //128 bits
 
    static function encrypt($key, $iv, $data) {
     
        if (strlen($key) < JavaPHPCompatibleEncryption::$CIPHER_KEY_LEN) {
            $key = str_pad("$key", JavaPHPCompatibleEncryption::$CIPHER_KEY_LEN, "0"); //0 pad to len 16
        } else if (strlen($key) > JavaPHPCompatibleEncryption::$CIPHER_KEY_LEN) {
            $key = substr($str, 0, JavaPHPCompatibleEncryption::$CIPHER_KEY_LEN); //truncate to 16 bytes
        }
         
        $encodedEncryptedData = base64_encode(openssl_encrypt($data, JavaPHPCompatibleEncryption::$OPENSSL_CIPHER_NAME, $key, OPENSSL_RAW_DATA, $iv));
        $encodedIV = base64_encode($iv);
        $encryptedPayload = $encodedEncryptedData.":".$encodedIV;
 
        return bin2hex($encryptedPayload);
         
    }
 
     
    static function decrypt($key, $data) {
        if (strlen($key) < JavaPHPCompatibleEncryption::$CIPHER_KEY_LEN) {
            $key = str_pad("$key", JavaPHPCompatibleEncryption::$CIPHER_KEY_LEN, "0"); //0 pad to len 16
        } else if (strlen($key) > JavaPHPCompatibleEncryption::$CIPHER_KEY_LEN) {
            $key = substr($str, 0, JavaPHPCompatibleEncryption::$CIPHER_KEY_LEN); //truncate to 16 bytes
        }
        $dataStr = hex2bin($data);
         
        $parts = explode(':', $dataStr); //Separate Encrypted data from iv.
        $decryptedData = openssl_decrypt(base64_decode($parts[0]), JavaPHPCompatibleEncryption::$OPENSSL_CIPHER_NAME, $key, OPENSSL_RAW_DATA, base64_decode($parts[1]));
         
        return $decryptedData;
    }
 
}
 
 
$iv = '9876543210fedcba';
$key = 'u7k3g4e6n7t6h7l2';

  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ data *************//






#                   المشتركين                   #
if($data == "co" && IsAdmin($chat_id) ){ 
    bot('answercallbackquery',[
        'callback_query_id'=>$update->callback_query->id,
        'text'=>"
        عدد مشتركين البوت📢 :- [ $V_Users_Count ] .
        ",
        'show_alert'=>true,
]);
}

$Last_message_id = null;

#                   رسالة للكل                   #
if($data == "$Str_Data_MagToAll" && IsAdmin($chat_id)){ 
       
    Put_In_Commands_File("$Str_Data_MagToAll");	
	AdminEditMsg($chat_id,$message_id,"▪️ ارسل رسالتك الان 📩 وسيتم نشرها لـ [ $V_Users_Count ] مشترك .");
	$Last_message_id = $message_id;
}




if($text and $V_Commands == "$Str_Data_MagToAll" && IsAdmin($chat_id) ){
    
		
		bot('sendmessage',[
'chat_id'=>$chat_id,
'text'=>"*تم ارسال الرسالة بنجاح *",
'parse_mode'=>"Markdown",
'reply_to_message_id'=>$message->message_id,
]);
    SendMsgToUsers($text);
    
}

if($data == "$Str_Data_StartUserMsg" && IsAdmin($chat_id)){
	
    Put_In_Commands_File("$Str_Data_StartUserMsg");

AdminEditMsg($chat_id,$message_id," 
	
رسالة الترحيب الحالية :
	
	$V_DescribesStartUserMsg
	
	----------------------------
	
	
	قم بارسال رسالة رسالة الترحيب الجديدة
   ");
      


}

if($text and $V_Commands == "$Str_Data_StartUserMsg" && IsAdmin($chat_id) ){
    
    
    $MainSetting["informtion"]['$Str_Data_StartUserMsg'] = $text;
file_put_contents("$Str_MainSettingFile_Path",json_encode($MainSetting,32|128|265));



bot('sendmessage',[
'chat_id'=>$chat_id,
'text'=>"تم تعيين رسالة الترحيب التالية :",
'parse_mode'=>"Markdown",
'reply_to_message_id'=>$message->message_id,
]);

    Put_In_Commands_File("No");

}





if($data == "$Str_Data_Cancel" && IsAdmin($chat_id)){
	
	DeleteMessage($chat_id,$message_id);
	
	Put_In_Commands_File("no");
	
}

if($data == "$Str_Data_AdminList_Home" && IsAdmin($chat_id)){
	
	DeleteMessage($chat_id,$message_id);
	
	Put_In_Commands_File("no");
	AdminList();
}

if($data == "$Str_Data_AlarmForNewUser" && IsAdmin($chat_id)){
	




	
if($MainSetting["informtion"]["$Str_Data_AlarmForNewUser"]!="✅"){
$dp = "✅";
EditMessageText($chat_id,$message_id,"تم تفعيل التنبيهات");
}else{
$dp ="❎";
EditMessageText($chat_id,$message_id,"تم الغاء تفعيل التنبيهات");
}
$MainSetting["informtion"]["$Str_Data_AlarmForNewUser"] = $dp;
file_put_contents("$Str_MainSettingFile_Path",json_encode($MainSetting,32|128|265));
}


if($data == "$Str_Data_BlockUser" && IsAdmin($chat_id)){
  
   
AdminEditMsg($chat_id,$message_id," • ارسل ايدي شخص للحظر");
   

    Put_In_Commands_File("$Str_Data_BlockUser");
}
  
  
 if($text and $V_Commands == "$Str_Data_BlockUser" && IsAdmin($chat_id) && is_numeric($text) ){
   
  if(in_array($text,$V_BlockUsers)){
	  
 bot('sendmessage',[
'chat_id'=>$chat_id,
'text'=>"*محضور مسبقاً ⛔️*",
'parse_mode'=>"Markdown",
'reply_to_message_id'=>$message->message_id,
]);

 Put_In_Commands_File("no");
  }else {	  
bot('sendmessage',[
'chat_id'=>$chat_id,
'text'=>"*تم حظر الشخص من البوت ⛔️*",
'parse_mode'=>"Markdown",
'reply_to_message_id'=>$message->message_id,
]);
bot("sendmessage",[
'chat_id'=>$text,
"text"=>"*تم حظرك من البوت ⛔️*",
]);
  
     
	
	 
$Bot_Users_Json["BlockUser"][]="$text";
file_put_contents("$Str_Bot_Users_Json_File_Path", json_encode($Bot_Users_Json));
	 
   
 Put_In_Commands_File("none");
  }
  
}


#الغاء الحظر
if($data == "$Str_Data_UnBlockUser" && IsAdmin($chat_id)){
   Put_In_Commands_File("$Str_Data_UnBlockUser");
   
   AdminEditMsg($chat_id,$message_id," • قم بارسال أيدي العضو للإلغاء الحظر عنه");

}






 if($text and $V_Commands == "$Str_Data_UnBlockUser" && IsAdmin($chat_id) && is_numeric($text) ){



if(in_array($text,$V_BlockUsers)){

$index = array_search($text, $V_BlockUsers);
unset($Bot_Users_Json["BlockUser"][$index]);
$Bot_Users_Json["BlockUser"]=array_values($Bot_Users_Json["BlockUser"]); 
$Bot_Users_Json["UnBlockUser"][]="$text";
file_put_contents("$Str_Bot_Users_Json_File_Path", json_encode($Bot_Users_Json));

bot('sendmessage',[
'chat_id'=>$chat_id, 
'text'=>"- ✅ تم الغاء حظر العضو بنجاح 
$text
",'parse_mode' =>"markdown",
'disable_web_page_preview' => true ,
'reply_markup'=>json_encode(['inline_keyboard'=>[
[['text'=>"🔙 𝙱𝙰𝙲𝙺",'callback_data'=>"$Str_Data_AdminList_Home"]],
]
])
]);
bot('sendmessage',[
'chat_id'=>$text, 
'text'=>"✅ لقد قام الادمن بالغاء الحظر عنك  .",
]);
}else{
bot('sendmessage',[
'chat_id'=>$chat_id, 
'text'=>"🚫 العضو ليسِ محظور مسبقاً",
'reply_markup'=>json_encode(['inline_keyboard'=>[
[['text'=>"🔙 𝙱𝙰𝙲𝙺",'callback_data'=>"$Str_Data_AdminList_Home"]],
]])
]);
}
}

if($data == "$Str_Data_ClearBlockList" && IsAdmin($chat_id)){
   Put_In_Commands_File("$Str_Data_ClearBlockList");
   
  
$Bot_Users_Json["BlockUser"] = null;
file_put_contents("$Str_Bot_Users_Json_File_Path", json_encode($Bot_Users_Json));
AdminEditMsg($chat_id,$message_id," • تم مسح قائمة المحضورين بنجاح");

}


if($data == "$Str_Data_BlockList" and $V_BlockUsers != null){

for($I = 0;$I <= count($V_BlockUsers)-1;$I++){
$api_user = json_decode(file_get_contents("http://api.telegram.org/bot$API_KEY/getChat?chat_id=$V_BlockUsers[$I]"));
$_user =$api_user->result->username;
$_first_name =$api_user->result->first_name;
$_last_name =$api_user->result->last_name;
$_name == $_first_name.' '.$_last_name;
$_id =$api_user->result->id;
$result = $result."- [$_first_name  $_last_name](https://t.me/$_user) - $_id"."\n";
}
bot('EditMessageText',[
'chat_id'=>$chat_id,
'message_id'=>$message_id,
'text'=>"اليك قائمة المحظورين : 
ꔹ┉ ┉ ┉ ┉ ┉ ┉ ┉ꔹ
$result",
'parse_mode'=>"markdown",
'disable_web_page_preview'=>true,
'reply_to_message_id'=>$message->message_id,
'reply_markup'=>json_encode([ 
'inline_keyboard'=>[
[['text'=>'رجوع' ,'callback_data'=>"$Str_Data_AdminList_Home"]],
]])
]);
exit();
}

if($data == "$Str_Data_UsersList" and $V_Users != null){

for($I = 0;$I <= count($V_Users)-1;$I++){
$api_user = json_decode(file_get_contents("http://api.telegram.org/bot$API_KEY/getChat?chat_id=$V_Users[$I]"));
$_user =$api_user->result->username;
$_first_name =$api_user->result->first_name;
$_last_name =$api_user->result->last_name;
$_name == $_first_name.' '.$_last_name;
$_id =$api_user->result->id;
$result = $result."- [$_first_name  $_last_name](https://t.me/$_user) - $_id"."\n";
}
bot('EditMessageText',[
'chat_id'=>$chat_id,
'message_id'=>$message_id,
'text'=>"اليك قائمة الاعضاء: 
ꔹ┉ ┉ ┉ ┉ ┉ ┉ ┉ꔹ
$result",
'parse_mode'=>"markdown",
'disable_web_page_preview'=>true,
'reply_to_message_id'=>$message->message_id,
'reply_markup'=>json_encode([ 
'inline_keyboard'=>[
[['text'=>'رجوع' ,'callback_data'=>"$Str_Data_AdminList_Home"]],
]])
]);
exit();
}

if($data == "$Str_Data_Admins_Section" && IsAdmin($chat_id)){
    
   
   Admins_Section_Panel();

}


if($data == "$Str_Data_Add_Admin" && IsAdmin($chat_id)){
 Put_In_Commands_File("$Str_Data_Add_Admin");
 
   AdminEditMsg($chat_id,$message_id,"قم بارسال ايدي المدير المراد اضافته");
    

}


 if($text and $V_Commands == "$Str_Data_Add_Admin" && IsAdmin($chat_id) && is_numeric($text) ){
   
  if(in_array($text,$V_Users)){
	  

$api_user = json_decode(file_get_contents("http://api.telegram.org/bot$API_KEY/getChat?chat_id=$text"));
$_user =$api_user->result->username;
$_first_name =$api_user->result->first_name;
$_last_name =$api_user->result->last_name;
$_name == $_first_name.' '.$_last_name;
$_id =$api_user->result->id;


AddNewAdminToJsonFile($_id,$_user,$_name);

   SendMessage($text,"تمت اضافتك كمدير في البوت ");


  }else {	  
bot('sendmessage',[
'chat_id'=>$chat_id,
'text'=>"*الشخص المراد اضافته ليس عضو في البوت",
'parse_mode'=>"Markdown",
'reply_to_message_id'=>$message->message_id,
]);

  
     
	
	 

	 
   
 
  }
 Put_In_Commands_File("no"); 
}

if($data == "$Str_Data_Admin_List" and $V_Managers != null){

for($I = 0;$I <= count($V_Managers)-1;$I++){
	$idd = $V_Managers[$I]["id"];
$api_user = json_decode(file_get_contents("http://api.telegram.org/bot$API_KEY/getChat?chat_id=$idd"));
$_user =$api_user->result->username;
$_first_name =$api_user->result->first_name;
$_last_name =$api_user->result->last_name;
$_name == $_first_name.' '.$_last_name;
$_id =$api_user->result->id;
$result = $result."- [$_first_name  $_last_name](https://t.me/$_user) - $_id"."\n";
}
bot('EditMessageText',[
'chat_id'=>$chat_id,
'message_id'=>$message_id,
'text'=>"قائمة المدراء: 
ꔹ┉ ┉ ┉ ┉ ┉ ┉ ┉ꔹ
$result",
'parse_mode'=>"markdown",
'disable_web_page_preview'=>true,
'reply_to_message_id'=>$message->message_id,
'reply_markup'=>json_encode([ 
'inline_keyboard'=>[
[['text'=>'رجوع' ,'callback_data'=>"$Str_Data_AdminList_Home"]],
]])
]);
exit();
}



  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ الدوال *************//
	
	
function AddNewAdminToJsonFile($_id,$_user,$_name){
	
	 global $V_Bot_Control;
	
	    global $Str_Json_Opject_Bot_Control_Setting_Name;
		  global $Str_Json_Opject_Bot_Control_Administration_Name;
		   global $Str_Json_Opject_Bot_Control_Administration_Admins_List_Name;
		     global $Str_Bot_Control_Path;
	
	$V_Bot_Control[$Str_Json_Opject_Bot_Control_Setting_Name][$Str_Json_Opject_Bot_Control_Administration_Name][$Str_Json_Opject_Bot_Control_Administration_Admins_List_Name][]=['id' => $_id, 'UserName' => $_user, 'name' => $_name];

file_put_contents("$Str_Bot_Control_Path", json_encode($V_Bot_Control));
}

function AdminList(){
	
	  
       global $V_Managers_Count;
     global $V_Users_Count;
        global $V_BlockUser_Count;
		 global $chat_id;
           global $message_id;
		   
		              global $V_AlarmForNewUser;
					    global $Str_Data_BlockUser;
						  global $Str_Data_ClearBlockList;
					             global $Str_Data_UnBlockUser;
								             global $Str_Data_AlarmForNewUser;					 
								 
							  global $Str_Data_StartUserMsg;
					             global $Str_Data_BotInfo;
								             global $Str_Data_MagToAll;	
											     global $Str_Data_BlockList;	
												 global $Str_Data_UsersList; 
												
											  global $Str_Data_Admins_Section; 
										



	
	bot('sendmessage',[
'chat_id'=>$chat_id, 
'text'=>"اهلا بك عزيزي الادمن في قائمة التحكم الخاص 

- الاحصائية : 


• عدد المدراء : $V_Managers_Count

• عدد الاعضاء : $V_Users_Count

• المحظورين: $V_BlockUser_Count

",
'parse_mode'=>markdown,
'disable_web_page_preview'=>true,
"message_id"=>$message_id,
'reply_markup'=>json_encode(['inline_keyboard'=>[

[['text'=>"- تعيين رسالة /start ",'callback_data'=>"$Str_Data_StartUserMsg"]],

[['text'=>" قسم المدراء ",'callback_data'=>"$Str_Data_Admins_Section"]],

[['text'=>"- تنبية دخول الاعضاء : $V_AlarmForNewUser",'callback_data'=>"$Str_Data_AlarmForNewUser"]],
[['text'=>"- حظر عضو ",'callback_data'=>"$Str_Data_BlockUser"],['text'=>"- الغاء حظر عضو ",'callback_data'=>"$Str_Data_UnBlockUser"]],
[['text'=>"- مسح قائمة الحظر ",'callback_data'=>"$Str_Data_ClearBlockList"],['text'=>"- عرض المحضورين ",'callback_data'=>"$Str_Data_BlockList"]],


[['text'=>"- معلومات البوت ",'callback_data'=>"$Str_Data_BotInfo"]],
  [['text'=>"- رسالة للكل ",'callback_data'=>"$Str_Data_MagToAll"]],
   [['text'=>"- قائمة الاعضاء ",'callback_data'=>"$Str_Data_UsersList"]], 
  

]
])
]);
	
}


function Admins_Section_Panel(){
	
	   global $chat_id;
	     global $message_id;
       global $V_Managers_Count;

         
		   
		              global $Str_Data_Add_Admin;
					    global $Str_Data_Remove_Admin;
						  global $Str_Data_Admin_List;
					        global $Str_Data_AdminList_Home;
										



	
	bot('EditMessageText',[
'chat_id'=>$chat_id, 
'text'=>"قائمة التحكم بالمدراء

- الاحصائية : 


• عدد المدراء : $V_Managers_Count



",
'parse_mode'=>markdown,
'disable_web_page_preview'=>true,
"message_id"=>$message_id,
'reply_markup'=>json_encode(['inline_keyboard'=>[

[['text'=>"ادارة المدراء",'callback_data'=>"ManageAdmin"]],

[['text'=>" عرض قائمة المدراء",'callback_data'=>"$Str_Data_Admin_List"]],

[['text'=>"- اضافة مدير ",'callback_data'=>"$Str_Data_Add_Admin"],['text'=>"- ازالة مدير ",'callback_data'=>"$Str_Data_Remove_Admin"]],
[['text'=>'رجوع' ,'callback_data'=>"$Str_Data_AdminList_Home"]],

  

]
])
]);
	
}



function CreateStartFolder(){
    
    global $Str_MangersFolder;
       global $Str_Administration_Folder;
     global $Str_Users_Folder;
        global $Str_Events_Folder;
		  global $Str_Log_Folder;
           global $from_id;
		    
 
mkdir($Str_Administration_Folder); 
 
    
mkdir($Str_MangersFolder);
    
    mkdir($Str_Users_Folder);
       mkdir($Str_Events_Folder);
	  
     mkdir($Str_Log_Folder);	  
	   
    

mkdir("Events/User");

mkdir("Events/User/$from_id");  

mkdir("Events/Admin");  

}




function AdminEditMsg($chat_id,$message_id,$Value){
	
	global $Str_Data_AdminList_Home;
	global $Str_Home;
	global $Str_Cancel;
	global $Str_Data_Cancel;
	
bot('EditMessageText',[
'chat_id'=>$chat_id, 
'text'=> "$Value",
'parse_mode' =>"markdown",
'disable_web_page_preview' => true ,
'message_id'=>$message_id,
    'reply_markup'=>json_encode([
        'inline_keyboard'=>[
[['text'=>"$Str_Cancel",'callback_data'=>"$Str_Data_Cancel"]] ,[['text'=>"$Str_Home",'callback_data'=>"$Str_Data_AdminList_Home"]]   
        ]
    ])
]);

}
	
	
	
	function addToJsonImageList($link, $category) {
    $file = file_get_contents('./images_list.json', true);
    $data = json_decode($file,true);
    unset($file);
    //you need to add new data as next index of data.
    $data[] = array('image' => $link, 'folder' => $category);
    $result=json_encode($data);
    file_put_contents('./images_list.json', $result);
    unset($result);
}

function Put_In_Commands_File($Value){
    
global $Str_Commands_File_Name;
global $from_id;
   
file_put_contents("Events/Admin/$from_id/$Str_Commands_File_Name","$Value");


}


function Put_In_Commands_User_File($Value){
    
global $Str_Commands_File_Name;
global $from_id;
   
file_put_contents("Events/User/$from_id/$Str_Commands_User_File_Name","$Value");


}



function Put_In_Json_NewUser_File($Value){
   
global $Bot_Users_Json;   
global $Str_Bot_Users_Json_File_Path;
global $chat_id;
   

$Bot_Users_Json["Users"][]="$chat_id";
	 file_put_contents("$Str_Bot_Users_Json_File_Path", json_encode($Bot_Users_Json));


}

function NoticeToDevloper($Msg) {
    
            global $name;
            global $chat_id;
    global $DevloperID;
    
bot('sendMessage',[
'chat_id'=>$DevloperID,
'text'=>"العضو $name - بالمعرف رقم 
`-$chat_id` 
:  $Msg "
]);

}



function IsJoinToObligatory_Channels($from_id) {
    
        global $Obligatory_Channels ;
      global $chat_id ;
         global $message_id ;
            global $DescribesStartJoinChatBot ; 
    
                  
       for ($i=0; $i < count($Obligatory_Channels); $i++) {  
           
           $stuts = GetMember($API_KEY,$Obligatory_Channels[$i],$from_id);
           if($stuts=="no"){
           bot('sendMessage',[
'chat_id'=>$chat_id,
'reply_to_message_id'=>$message_id,
'text'=>"
$DescribesStartJoinChatBot

",
'disable_web_page_preview'=>true,
'parse_mode'=>"markdown",
'reply_markup'=>json_encode([
'inline_keyboard'=>[
[['text'=>" اضغط للاشتراك في القناة ", 'url'=>"$Obligatory_Channels[$i]"]],

]
])
]);
            return false;
   } else {
      return true;
   }
        
        } 
   
}


function NoticeToAdmins($Msg) {
    
            global $name;
            global $chat_id;
    global $AdminsList;
    
       for ($i=0; $i < count($AdminsList); $i++) { 
           
           
         SendMessage($AdminsList[$i],$Msg);  
           } 
    


}


function GetMyTelegramInfo(){
    
global $username;
global $from_id;
global $chat_id; 
global $name;     
  global $message;   

$photo = "http://telegram.me/$username";
bot('SendPhoto',[
'chat_id'=>$chat_id,
'photo'=>$photo,
'caption'=>"
👤| اسمك : $name
🧩| معرفك: @$username
ℹ️| ايديك :  $from_id 
⚙| بايو المستخدم :
", 

]);
}


function IsManager($chat_id) {
    
        global $V_Managers;
		   global $Devloper_Telegram_ID;
         
		for($I = 0;$I <= count($V_Managers);$I++){
	$iddd = $V_Managers[$I]["id"];
		
			 
			 SendMessage($Devloper_Telegram_ID,$iddd);
    if($iddd == $chat_id || $chat_id ==$Devloper_Telegram_ID ) { // I would strictly check (type) incase of 0
       return true;
	   
        break; // break out if you dont care about the rest
    }else {
      return false;
   }
  
		 }
    
	

}



function IsAdmin($chat_id) {
    
        global $AdminsList;
            global $AdminsListFromFile;
    
 if( in_array($chat_id,$AdminsList)
|| in_array($chat_id, $AdminsListFromFile)
){
      return true;
   } else {
      return false;
   }
}


function Put_In_File($Path,$Value){
    
file_put_contents("$Path","$Value",FILE_APPEND);
}

function SendMsgToUsers($Msg) {
    

    global $V_Users;
    
       for ($i=0; $i < count($V_Users); $i++) {
         SendMessage($V_Users[$i],$Msg);  
            Put_In_Commands_File("SendMsgToAllUsers_Done");
        } 
    


}

function CheckUserIsBlock($chat_id) {
    
        global $V_BlockUsers;
   
 if(in_array($chat_id,$V_BlockUsers)){
      return true;
   } else {
      return false;
   }
}






  ///۞-----------------------------------/۞//
   ///۞-----------------------------------/۞//

    //************ خاص تيلجرام *************//
function bot($method, $datas = [])
  {
  $url = "https://api.telegram.org/bot" . API_KEY . "/" . $method;
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $datas);
  $res = curl_exec($ch);
  if (curl_error($ch))
    {
    var_dump(curl_error($ch));
    }
    else
    {
    return json_decode($res);
    }
  }
  
  
  function GetMe(){
    return bot('getMe');
}

function GetChatStats($chat_id,$token) {
  $url = 'https://api.telegram.org/bot'.$token.'/getChatAdministrators?chat_id='.$chat_id;
  $result = file_get_contents($url);
  $result = json_decode ($result);
  $result = $result->ok;
  return $result;
}


 function GetMember($token,$idchannel,$from_id) {
     
   
     
  $join = file_get_contents("https://api.telegram.org/bot".$token."/getChatMember?chat_id=@$idchannel&user_id=".$from_id);
if((strpos($join,'"status":"left"') 
or strpos($join,'"Bad Request: USER_ID_INVALID"') 
or strpos($join,'"Bad Request: user not found"') 
or strpos($join,'"ok": false') 
or strpos($join,'"status":"kicked"')) !== false){
    
$Result="no";
    
}else
{
    $Result="yes";
    
}
return $Result;


}

function Add($path,$content){
	$file = fopen("$path","a") or die("Unable to open file!");
	fwrite($file,"$content");
	fclose($file);
}
function GetUpdates($offset=null,$limit=100,$timeout=null,$allowed_updates=[]){
    return bot('getUpdates',[
    'offset'=>$offset,
    'limit'=>$limit,
    'timeout'=>$timeout,
    'allowed_updates'=>$allowed_updates
    ]);
}
function SetWebhook($url,$certificate=null,$max_connections=100,$allowed_updates=[]){
	return bot('setWebhook',[
	'url'=>$url,
	'certificate'=>$certificate,
	'max_connections'=>$max_connections,
	'allowed_updates'=>$allowed_updates,
	]);
}
function DeleteWebhook(){
	return bot('deleteWebhook');
}
function GetWebhookInfo(){
	return bot('getWebhookInfo');
}
function SendChatAction($chat_id,$action){
	bot('sendChatAction',[
	'chat_id'=>$chat_id,
	'action'=>$action
	]);
}

function SendMessage($chat_id,$text,$parse_mode="MARKDOWN",$disable_web_page_preview=true,$reply_to_message_id=null,$reply_markup=null){
    return bot('sendMessage',[
	'chat_id'=>$chat_id,
	'text'=>$text,
	'parse_mode'=>$parse_mode,
	'disable_web_page_preview'=>$disable_web_page_preview,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}


function ForwardMessage($chat_id,$from_chat_id,$message_id){
	return bot('forwardMessage',[
	'chat_id'=>$chat_id,
	'from_chat_id'=>$from_chat_id,
	'disable_notification'=>false,
	'message_id'=>$message_id
	]);
}

function SendPhoto($chat_id,$photo,$caption=null,$parse_mode="MARKDOWN",$reply_to_message_id=null,$reply_markup=null){
	return bot('sendPhoto',[
	'chat_id'=>$chat_id,
	'photo'=>$photo,
	'caption'=>$caption,
	'parse_mode'=>$parse_mode,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendAudio($chat_id,$audio,$caption=null,$parse_mode="MARKDOWN",$duration=null,$performer=null,$title=null,$thumb=null,$reply_to_message_id=null,$reply_markup=null){
	return bot('sendAudio',[
	'chat_id'=>$chat_id,
	'audio'=>$audio,
	'caption'=>$caption,
	'parse_mode'=>$parse_mode,
	'duration'=>$duration,
	'performer'=>$performer,
	'title'=>$title,
	'thumb'=>$thumb,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendDocument($chat_id,$document,$thumb=null,$caption=null,$parse_mode="MARKDOWN",$reply_to_message_id=null,$reply_markup=null){
	return bot('sendDocument',[
	'chat_id'=>$chat_id,
	'document'=>$document,
	'thumb'=>$thumb,
	'caption'=>$caption,
	'parse_mode'=>$parse_mode,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendVideo($chat_id,$video,$duration=null,$width=null,$height=null,$thumb=null,$caption=null,$parse_mode="MARKDOWN",$reply_to_message_id=null,$reply_markup=null,$supports_streaming=null){
	return bot('sendVideo',[
	'chat_id'=>$chat_id,
	'video'=>$video,
	'duration'=>$duration,
	'width'=>$width,
	'height'=>$height,
	'thumb'=>$thumb,
    'caption'=>$caption,
	'parse_mode'=>$parse_mode,
	'supports_streaming'=>$supports_streaming,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendAnimation($chat_id,$animation,$duration=null,$width=null,$height=null,$thumb=null,$caption=null,$parse_mode="MARKDOWN",$reply_to_message_id=null,$reply_markup=null){
	return bot('sendAnimation',[
	'chat_id'=>$chat_id,
	'animation'=>$animation,
	'duration'=>$duration,
	'width'=>$width,
	'height'=>$height,
	'thumb'=>$thumb,
    'caption'=>$caption,
	'parse_mode'=>$parse_mode,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendVoice($chat_id,$voice,$caption=null,$parse_mode="MARKDOWN",$duration=null,$reply_to_message_id=null,$reply_markup=null){
	return bot('sendVoice',[
	'chat_id'=>$chat_id,
	'voice'=>$voice,
	'caption'=>$caption,
	'parse_mode'=>$parse_mode,
	'duration'=>$duration,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendVideoNote($chat_id,$video_note,$duration=null,$length=null,$width=null,$height=null,$thumb=null,$caption=null,$parse_mode="MARKDOWN",$reply_to_message_id=null,$reply_markup=null){
	return bot('sendVideoNote',[
	'chat_id'=>$chat_id,
	'video_note'=>$video_note,
	'duration'=>$duration,
	'length'=>$length,
	'thumb'=>$thumb,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendMediaGroup($chat_id,$media,$reply_to_message_id=null){
	return bot('sendMediaGroup',[
	'chat_id'=>$chat_id,
	'media'=>$media,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id
	]);
}
function SendLocation($chat_id,$latitude,$longitude,$live_period=null,$reply_to_message_id=null,$reply_markup=null){
	return bot('sendLocation',[
	'chat_id'=>$chat_id,
	'latitude'=>$latitude,
	'longitude'=>$longitude,
	'live_period'=>$live_period,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendContact($chat_id,$phone_number,$first_name,$last_name=null,$reply_to_message_id=null,$reply_markup=null,$vcard=null){
	return bot('sendContact',[
	'chat_id'=>$chat_id,
	'phone_number'=>$phone_number,
	'first_name'=>$first_name,
	'last_name'=>$last_name,
	'vcard'=>$vcard,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function SendPoll($chat_id,$question,$options,$reply_to_message_id=null,$reply_markup=null){
	return bot('sendPoll',[
	'chat_id'=>$chat_id,
	'question'=>$question,
	'options'=>$options,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function GetUserProfilePhotos($user_id,$offset=null,$limit=null){
    return bot('getUserProfilePhotos',[
	'user_id'=>$user_id,
	'offset'=>$offset,
	'limit'=>$limit
	]);
}
function GetFile($file_id){
    return bot('getFile',[
	'file_id'=>$file_id
	]);
}
function KickChatMember($chat_id,$user_id,$until_date=null){
	return bot('kickChatMember',[
	'chat_id'=>$chat_id,
	'user_id'=>$user_id,
	'until_date'=>$until_date
	]);
}
function PromoteChatMember($chat_id,$user_id){
	return bot('promoteChatMember',[
	'chat_id'=>$chat_id,
	'user_id'=>$user_id,
	'can_delete_messages'=>true,
    'can_invite_users'=>true,
    'can_restrict_members'=>true,
    'can_pin_messages'=>true,
	]);
}
function DemoteChatMember($chat_id,$user_id){
	return bot('promoteChatMember',[
	'chat_id'=>$chat_id,
	'user_id'=>$user_id,
	'can_change_info'=>false,
	'can_post_messages'=>false,
	'can_edit_messages'=>false,
	'can_delete_messages'=>false,
	'can_invite_users'=>false,
	'can_restrict_members'=>false,
	'can_pin_messages'=>false,
	'can_promote_members'=>false
	]);
}
function ExportChatInviteLink($chat_id){
    return bot('exportChatInviteLink',[
	'chat_id'=>$chat_id
	]);
}
function SetChatPhoto($chat_id,$photo){
	return bot('setChatPhoto',[
	'chat_id'=>$chat_id,
	'photo'=>$photo
	]);
}
function DeleteChatPhoto($chat_id){
	return bot('deleteChatPhoto',[
	'chat_id'=>$chat_id
	]);
}
function SetChatTitle($chat_id,$title){
	return bot('setChatTitle',[
    'chat_id'=>$chat_id,
    'title'=>$title
    ]);
}
function SetChatDescription($chat_id,$description){
	return bot('setChatDescription',[
    'chat_id'=>$chat_id,
    'description'=>$description
    ]);
}
function PinChatMessage($chat_id,$message_id){
	return bot('pinChatMessage',[
    'chat_id'=>$chat_id,
    'message_id'=>$message_id,
	'disable_notification'=>false
    ]);
}
function UnpinChatMessage($chat_id){
	return bot('unpinChatMessage',[
    'chat_id'=>$chat_id,
    ]);
}
function LeaveChat($chat_id){
	return bot('LeaveChat',[
	'chat_id'=>$chat_id
	]);
}
function GetChat($chat_id){
    return bot('getChat',[
	'chat_id'=>$chat_id
	]);
}
function GetChatAdministrators($chat_id){
    return bot('getChatAdministrators',[
	'chat_id'=>$chat_id
	]);
}
function GetChatMembersCount($chat_id){
    return bot('getChatMembersCount',[
	'chat_id'=>$chat_id
	]);
}
function GetChatMember($chat_id,$user_id){
    return bot('getChatMember',[
	'chat_id'=>$chat_id,
	'user_id'=>$user_id
	]);
}


function AnswerCallbackQuery($callback_query_id,$text,$show_alert=false,$url=null,$cache_time=0){
	return bot('answerCallbackQuery',[
    'callback_query_id'=>$callback_query_id,
    'text'=>$text,
    'show_alert'=>$show_alert,
    'url'=>$url,
    'cache_time'=>$cache_time
    ]);
}
function EditMessageText($chat_id,$message_id,$text,$inline_message_id=null,$parse_mode="MARKDOWN",$disable_web_page_preview=true,$reply_markup=null){
	return bot('editMessageText',[
    'chat_id'=>$chat_id,
	'message_id'=>$message_id,
	'inline_message_id'=>$inline_message_id,
    'text'=>$text,
    'parse_mode'=>$parse_mode,
	'disable_web_page_preview'=>$disable_web_page_preview,
    'reply_markup'=>$reply_markup
	]);
}
function EditMessageCaption($chat_id,$message_id,$caption,$inline_message_id=null,$parse_mode="MARKDOWN",$reply_markup=null){
	return bot('editMessageCaption',[
    'chat_id'=>$chat_id,
	'message_id'=>$message_id,
	'inline_message_id'=>$inline_message_id,
    'caption'=>$caption,
    'parse_mode'=>$parse_mode,
    'reply_markup'=>$reply_markup
	]);
}
function EditMessageMedia($chat_id,$message_id,$media,$inline_message_id=null,$parse_mode="MARKDOWN",$reply_markup=null){
	return bot('editMessageMedia',[
    'chat_id'=>$chat_id,
	'message_id'=>$message_id,
	'inline_message_id'=>$inline_message_id,
    'media'=>$media,
    'reply_markup'=>$reply_markup
	]);
}
function EditMessageReplyMarkup($chat_id,$message_id,$reply_markup,$inline_message_id=null){
	return bot('editMessageReplyMarkup',[
    'chat_id'=>$chat_id,
	'message_id'=>$message_id,
	'inline_message_id'=>$inline_message_id,
    'reply_markup'=>$reply_markup
	]);
}
function StopPoll($chat_id,$message_id,$reply_markup=null){
	return bot('stopPoll',[
    'chat_id'=>$chat_id,
	'message_id'=>$message_id,
    'reply_markup'=>$reply_markup
	]);
}
function DeleteMessage($chat_id,$message_id){
	return bot('deletemessage',[
	'chat_id'=>$chat_id,
	'message_id'=>$message_id
	]);
}
function SendSticker($chat_id,$sticker,$reply_to_message_id=null,$reply_markup=null){
	return bot('sendSticker',[
	'chat_id'=>$chat_id,
	'sticker'=>$sticker,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}
function AnswerInlineQuery($inline_query_id,$results,$cache_time=0,$is_personal=false,$next_offset=null,$switch_pm_text=null,$switch_pm_parameter=null){
	return bot('answerInlineQuery',[
    'inline_query_id'=>$inline_query_id,
    'results'=>$results,
    'cache_time'=>$cache_time,
    'is_personal'=>$is_personal,
    'next_offset'=>$next_offset,
    'switch_pm_text'=>$switch_pm_text,
    'switch_pm_parameter'=>$switch_pm_parameter
    ]);
}
function SendGame($chat_id,$game_short_name,$reply_to_message_id=null,$reply_markup=null){
	return bot('sendGame',[
	'chat_id'=>$chat_id,
	'game_short_name'=>$game_short_name,
	'disable_notification'=>false,
	'reply_to_message_id'=>$reply_to_message_id,
	'reply_markup'=>$reply_markup
	]);
}