Qaysi biridan boshlili?
Anonymous Poll
60%
0 dan bot ochish
19%
PHP kodlar kere
21%
send,admin panel,api..... shunaqa kodlar.
Learn to Code | #Personal-Blog !
Qaysi biridan boshlili?
Hozircha 0 dan bot ochishda ko'p ovoz.
O'rganishni boshlimiz qo'ldan kegancha.
O'rganishni boshlimiz qo'ldan kegancha.
Mana talablarga binoan ishlatib ko'rilar.
O'ylimanki tushunib olasla botni ishlashiga qarab.
@codelesson
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
Endi knopka ya'ni menyu qoshshishi orgatilimi
Anonymous Poll
56%
Ha
14%
Tezro
30%
Yo dgan javob yu😂🙃
Learn to Code | #Personal-Blog !
@codelesson_bot shu botti korila kimga shu funksiya kere bosa botti kodini tashimiz)
Mana tepadagi bot kodi:
● @codelesson
<?php
$token = 'codelesson'; //token yozila
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);
}
}
function del($nomi){
array_map('unlink', glob("$nomi"));
}
function objectToArrays($object)
{
if (!is_object($object) && !is_array($object)) {
return $object;
}
if (is_object($object)) {
$object = get_object_vars($object);
}
return array_map("objectToArrays", $object);
}
$update =
json_decode(file_get_contents('php://input'));
//inline ga methodlar
$data = $update->callback_query->data;
$chat_id2 = $update->callback_query->message->chat->id;
$message_id2 = $update->callback_query->message->message_id;
//oddiy knopkaga methodlar
$xabar = $update->message;
$xabar_id = $xabar->message_id;
$chat_id = $xabar->chat->id;
$text = $xabar->text;
$menu=json_encode([
'inline_keyboard'=>[
[['text'=>"1-menu","callback_data"=>"menu1"],['text'=>"2-menu","callback_data"=>"menu2"]],
]
]);
$back=json_encode([
'inline_keyboard'=>[
[['text'=>"orqaga","callback_data"=>"back"]],
]
]);
if($text=="/start"){
bot('SendMessage',[
'chat_id'=>$chat_id,
'text'=>"kanalimiz @codelesson ",
'reply_markup'=>$menu,
]);
}
if($data=="menu1"){
bot('SendMessage',[
'chat_id'=>$chat_id2,
'text'=>"siz 1-menu ni bosdingiz !",
'reply_markup'=>$back,
]);
}
if($data=="menu2"){
bot('SendMessage',[
'chat_id'=>$chat_id2,
'text'=>"siz 2-menu ni bosdingiz !",
'reply_markup'=>$back,
]);
}
if($data=="back"){
bot('SendMessage',[
'chat_id'=>$chat_id2,!
'text'=>"siz orqaga qaytdingiz",
'reply_markup'=>$menu,
]);
}● @codelesson
$menu=json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>"Oddiy"],['text'=>"Noodatiy"]],
]
]);
if($text=="/start"){
bot('SendMessage',[
'chat_id'=>$chat_id,
'text'=>"Assalomu Aleykum",
'reply_markup'=>$menu,
]);
}