<?php
ob_start();
$API_KEY = "Bot tokeni";
define('API_KEY',$API_KEY);
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);
}
}
$update = json_decode(file_get_contents('php://input'));
$message = $update->message;
$chid = $message->chat->id;
$text = $message->text;
$odam = $message->chat->first_name;
if($text=="/start"){
bot('sendMessage',[
'chat_id'=>$chid ,
'text'=>"👋Salom $odam @PhpCoderTm Kanaliga azo boʻling",
]);
}
Oddiygina kod
/start bossa nikingiz bilan salom beradi
@FantasticCoder
ob_start();
$API_KEY = "Bot tokeni";
define('API_KEY',$API_KEY);
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);
}
}
$update = json_decode(file_get_contents('php://input'));
$message = $update->message;
$chid = $message->chat->id;
$text = $message->text;
$odam = $message->chat->first_name;
if($text=="/start"){
bot('sendMessage',[
'chat_id'=>$chid ,
'text'=>"👋Salom $odam @PhpCoderTm Kanaliga azo boʻling",
]);
}
Oddiygina kod
/start bossa nikingiz bilan salom beradi
@FantasticCoder
Assalomu alaykum hammaga Kanal bir necha kun ichida oʻz faoliyatini boshlaydi!!
if($text == "/PhpCoderTM"&&$fadmin==$admin){
bot('sendmessage',[
'chat_id'=>$admin,
'text'=>"Assalomu alaykum $admin Admin panelga xush kelibsiz",
'parse_mode' => 'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'👤Send user'],['text'=>'👥Send group']],
[['text'=>'👤Userlar'],['text'=>'👥Guruhlar']],
[['text'=>'📊Statistika']]
]
]),
]);
}
/* Bu kodni @Super_Coder Tuzib ciqdi Manbasiz Osen S******n */
if($text == "🔙orqaga"&&$fadmin==$admin){
bot('sendmessage',[
'chat_id'=>$admin,
'text'=>"Assalomu alaykum admin panelga xush kelibsiz",
'parse_mode' => 'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'👤Send user'],['text'=>'👥Send group']],
[['text'=>'👤Userlar'],['text'=>'👥Guruhlar']],
[['text'=>'📊Statistika']]
]
]),
]);
}
// Bu Kod @PhpCoderTM kanallarida tarqaldi
if($text == "👥Guruhlar"&&$fadmin==$admin){
bot('sendmessage',[
'chat_id'=>$admin,
'text'=>$guruhlar,
'parse_mode'=>'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'🔙orqaga']],
]
]),
]);
}
if($text == "👤Userlar"&&$fadmin==$admin){
bot('sendmessage',[
'chat_id'=>$admin,
'text'=>$userlar,
'parse_mode'=>'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'🔙orqaga']],
]
]),
]);
}
if($text == "📊Statistika"&&$fadmin==$admin){
$gr = substr_count($guruhlar,"\n");
$us = substr_count($userlar,"\n");
$obsh = $gr + $us;
bot('sendmessage',[
'chat_id'=>$admin,
'reply_to_message_id'=>$mesid,
'text'=> "<b> Bot statistikasi:</b>\n\nA'zolar: <b>$us</b>\n Guruhlar: <b>$gr</b>\nUmumiy: <b>$obsh</b>",
'parse_mode' => 'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'🔙orqaga']],
]
]),
]);
}
bot('sendmessage',[
'chat_id'=>$admin,
'text'=>"Assalomu alaykum $admin Admin panelga xush kelibsiz",
'parse_mode' => 'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'👤Send user'],['text'=>'👥Send group']],
[['text'=>'👤Userlar'],['text'=>'👥Guruhlar']],
[['text'=>'📊Statistika']]
]
]),
]);
}
/* Bu kodni @Super_Coder Tuzib ciqdi Manbasiz Osen S******n */
if($text == "🔙orqaga"&&$fadmin==$admin){
bot('sendmessage',[
'chat_id'=>$admin,
'text'=>"Assalomu alaykum admin panelga xush kelibsiz",
'parse_mode' => 'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'👤Send user'],['text'=>'👥Send group']],
[['text'=>'👤Userlar'],['text'=>'👥Guruhlar']],
[['text'=>'📊Statistika']]
]
]),
]);
}
// Bu Kod @PhpCoderTM kanallarida tarqaldi
if($text == "👥Guruhlar"&&$fadmin==$admin){
bot('sendmessage',[
'chat_id'=>$admin,
'text'=>$guruhlar,
'parse_mode'=>'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'🔙orqaga']],
]
]),
]);
}
if($text == "👤Userlar"&&$fadmin==$admin){
bot('sendmessage',[
'chat_id'=>$admin,
'text'=>$userlar,
'parse_mode'=>'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'🔙orqaga']],
]
]),
]);
}
if($text == "📊Statistika"&&$fadmin==$admin){
$gr = substr_count($guruhlar,"\n");
$us = substr_count($userlar,"\n");
$obsh = $gr + $us;
bot('sendmessage',[
'chat_id'=>$admin,
'reply_to_message_id'=>$mesid,
'text'=> "<b> Bot statistikasi:</b>\n\nA'zolar: <b>$us</b>\n Guruhlar: <b>$gr</b>\nUmumiy: <b>$obsh</b>",
'parse_mode' => 'html',
'reply_markup'=>json_encode([
'resize_keyboard'=>true,
'keyboard'=>[
[['text'=>'🔙orqaga']],
]
]),
]);
}