TGTGInsighttelegram intelligenceLIVE / telegram public index
← Learn to Code | #Personal-Blog !
Learn to Code | #Personal-Blog ! avatar

TGINSIGHT POST

Post #6

@codelesson

Learn to Code | #Personal-Blog !

Visninger153Antal visninger
Publiceret31. jan.31.01.2021, 15.25
Indhold

Opslagsindhold

Mana talablarga binoan ishlatib ko'rilar. O'ylimanki tushunib olasla botni ishlashiga qarab. <?php //@codelesson kanali $token = 'bot tokeni'; //token yozasiz// function bot($method,$datas=[]){ global $token; $url = "https://api.telegram.org/bot".$token."/".$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); } } $update = json_decode(file_get_contents('php://input')); $xabar = $update->message; $xabar_id = $xabar->message_id; $chat_id = $xabar->chat->id; $text = $xabar->text; if($text=="/start"){ bot('SendMessage',[ 'chat_id'=>$chat_id, 'text'=>"Salom botimizga hush kelibsiz!", //start bosganda keladigan matn// ]); } @codelesson