<?php
/*
//====================(Info)================================================//
In The Name Of God | به نام خدا

سورس: Mail Chi
نویسنده سورس: @MrNimble | Mehdi Yousefi
کانال ما: @Nic_Source

کپی میکنی منبع رو بزن
//====================(Info)================================================//
*/
error_reporting(0);
define('API_KEY','680191601:AAGidmLqGH_TYxZT2hbb_kgrDt7-AEy5nQ4');
$token = "680191601:AAGidmLqGH_TYxZT2hbb_kgrDt7-AEy5nQ4";
$channel = "VipParaz";
//====================(Method)==============================================//
function MehdiYousefi($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);}}
//=====================(Api)==============================================//
$time = file_get_contents("http://mehdiyousefii.lordmizban.ir/api/date.php");
$date = file_get_contents("http://webservice.lorddeveloper.ir/date-time/?input=y/m/d&time=-86400&lang=en");
//====================(Variables)=============================================//
$update = json_decode(file_get_contents('php://input'));
$message = $update->message;
$text = $update->message->text;
$chat_id = $update->message->chat->id;
$message_id = $update->message->message_id;
$first_name = $update->message->from->first_name;
$first = $update->callback_query->from->first_name;
$chatid = $update->callback_query->message->chat->id;
$data = $update->callback_query->data;
$query=$update->callback_query;
$inline=$update->inline_query;
$messageid = $update->callback_query->message->message_id;
$forchannel = json_decode(file_get_contents("https://api.telegram.org/bot".$token."/getChatMember?chat_id=@$channel&user_id=".$chat_id));
$tch = $forchannel->result->status;
//=====================(Function)==============================================//
function SendMessage($chat_id,$text,$keyboard){MehdiYousefi('SendMessage',['chat_id'=>$chat_id,'text'=>$text,'reply_markup'=>$keyboard]);}
function edit($chat_id,$meesage_id,$text,$reply_markup){MehdiYousefi('editMessageText',['chat_id'=>$chat_id,'message_id'=>$message_id,'text'=>$text,'reply_markup'=>$reply_markup]);}
function save($filename, $data){$file = fopen($filename, 'w');fwrite($file, $data);fclose($file);}
function sendphoto($chat_id, $photo, $caption){MehdiYousefi('sendphoto',['chat_id'=>$chat_id,'photo'=>$photo,'caption'=>$caption,]);}
function EditMessageText($chat_id, $message_id, $text, $parse_mode, $disable_web_page_preview, $keyboard){MehdiYousefi('editMessagetext', ['chat_id' => $chat_id,'message_id' => $message_id,'text' => $text,'parse_mode' => $parse_mode,'disable_web_page_preview' => $disable_web_page_preview,'reply_markup' => $keyboard]);}
//====================(Start)==================================================//
if($text == "/start"){
	if($tch == 'member' or $tch == 'creator' or $tch == 'administrator'){
	MehdiYousefi('SendMessage',[
	'chat_id'=>$chat_id,
	'text'=>"سلام | $first_name | 😉👋🏻

به ربات دریافت ساعت و تاریخ خوش امدید 💪🏻❤️

با استفاده از این ربات میتونید به راحتی ساعت و تاریخ رو دریافت کنید👇🏼",
	'pars_mode'=>'html',
	'reply_markup'=>json_encode(['inline_keyboard'=>[
[['text'=>"👇🏼⏰ ساعت ⏰👇🏼",'callback_data'=>"null"]],
[['text'=>" $time ",'callback_data'=>"null"]],
[['text'=>"👇🏼📆 تاریخ 📆👇🏼",'callback_data'=>"null"]],
[['text'=>" $date ",'callback_data'=>"null"]],
	],'resize_keyboard'=>true])
	]);
}else {
    MehdiYousefi('sendmessage', [
        'chat_id' => $chat_id,
        'text' => "🌟 لطفا قبل از استفاده از ربات در کانال مربوط 
به ما عضو شوید تا بتوانید از ربات استفاده کنید👇🏼

✨کانال :
@$channel

✨ کانال :
@$channel


سپس مجدد ربات را /start کنید"
    ]);
    return false;
}
}
/*
-----------------------------------
In The Name Of God

نویسنده : @MrNmble (Mehdi Yousefi)

اپن شده در کانال
 @Nic_Source
 
 کپی فقط با ذکر منبع
-----------------------------------
*/
?>