2023 yilni ham tiqdilaring π’ π
Please open Telegram to view this post
VIEW IN TELEGRAM
π’1π³1
Please open Telegram to view this post
VIEW IN TELEGRAM
<?php
$token = 'Bot tokeningiz';
$chat_id = 'Chat ID';
$document = 'faylning_to'liq_manzili.jpg'; // Yuborishni istagan fayl manzili
$apiUrl = "https://api.telegram.org/bot{$token}/sendDocument";
$postFields = [
'chat_id' => $chat_id,
'document' => new CURLFile($document),
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:multipart/form-data']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
Please open Telegram to view this post
VIEW IN TELEGRAM
π1
$update = json_decode(file_get_contents('php://input'));
$type = $message->chat->type;
$text = $message->text;
$cid = $message->chat->id;
$ispremium = $message->from->is_premium;
if($text=="/start" and $type == "private"){
bot('sendmessage',[
'chat_id'=>$cid,
'reply_to_message_id'=>$mid,
'text'=>"π Salom bizni botimizga xush kelibsiz!",
'parse_mode' => 'html',
]);
if($ispremium){
bot('sendmessage',[
'chat_id'=>$cid,
'text'=>"<b>βοΈ Premiumingiz bor ekan!</b>",
'parse_mode' => 'html',
]);
}else{}
}Please open Telegram to view this post
VIEW IN TELEGRAM
function one($word){
$firstChar = $word[0];
return $firstChar;
}
function two($word) {
$last = $word[strlen($word) - 1];
return $last;
}
$text = "Yaxshi Dasturchilar";
$fine = one($text);
$cds = two($text);
echo "$text ning 1-harfi: $fine";
echo "\n";
echo "$text ning ohirgi harfi: $cds";Please open Telegram to view this post
VIEW IN TELEGRAM
$antifloodDelay = 3; // To'xtash uchun vaqtni belgilash (sekundda)
$antifloodLimit = 5; // To'xtash limitini belgilash
// Antiflood uchun o'zgaruvchilarni o'zlashtirish
if (!isset($update['message']['date'])) {
$update['message']['date'] = time();
}
$user_id = $update['message']['from']['id'];
$user_key = 'antiflood_' . $user_id;
$floodCount = $redis->get($user_key);
if (!$floodCount) {
$floodCount = 1;
$redis->set($user_key, $floodCount, $antifloodDelay);
} else {
if ($floodCount >= $antifloodLimit) {
// To'xtalishni aniqlash
$delay = $redis->ttl($user_key);
if ($delay > 0) {
// To'xtalish uchun kichik xabar yuborish
$response['text'] = 'Iltimos, keyinroq yozing. Sabrli bo\'ling.';
$response['method'] = 'sendMessage';
$response['chat_id'] = $update['message']['chat']['id'];
$response['reply_to_message_id'] = $update['message']['message_id'];
$response['parse_mode'] = 'HTML';
sleep($delay);
return $response;
} else {
$redis->set($user_key, 1, $antifloodDelay);
}
} else {
// Antiflood ni ozgartirish
$redis->incr($user_key);
}
}
Please open Telegram to view this post
VIEW IN TELEGRAM
π2
Random reaksiya bosadigan funksiya (bot uchun) β
π¬ @phpcodersuzb
return bot('setmessagereaction', [
'chat_id' => $cid,
'message_id' => $mid,
'reaction' => json_encode(array([
'type' => 'emoji',
'emoji' => $reaction,
])
)
]);
}
if(isset($message)){
$reactions = ['π', 'π€―', 'π€','π₯','β€οΈ','π', 'π€·ββοΈ', 'π','π','π€','π','π',];
$randomReaction = $reactions[array_rand($reactions)];
reaction($cid, $mid, $randomReaction);
}
Please open Telegram to view this post
VIEW IN TELEGRAM
π΄ Videoni bazaga saqlaydi va bot orqali tasodifiy tarzda yuboriladi! (Via for random β‘οΈ )
π¬ @phpcodersuzb
if($text == "π Tasodifiy video"){
$nec = file_get_contents("data/statvid.txt");
$phpcodersuzb = rand(1,$nec);
$video = file_get_contents("video/R_$phpcodersuzb.txt");
$ok = file_get_contents("step/$cid/ok.txt");
if(mb_stripos($ok,$phpcodersuzb)==false){
file_put_contents("step/$cid/ok.txt", "$ok\n$phpcodersuzb");
bot('sendvideo',[
'chat_id'=>$cid,
'video'=>"$video",
'caption'=>"<b>π₯ @$bot orqali yuklandi!</b>",
'parse_mode'=>"html",
'reply_markup'=>$vid,
]);
}else{
bot('sendMessage',[
'chat_id'=>$cid,
'text'=>"<b>π₯ Hozircha videolar mavjud emas keyinroq qayta urinib koΚ»ring!</b>",
'parse_mode'=>'html',
]);
}
}
if(($mp4) and $step=="yuk"){
$ha = bot('sendMessage',[
'chat_id'=>$cid,
'text'=>"<b>β
οΈ Video yuklandi!</b>",
'parse_mode'=>'html',
'reply_markup'=>$home,
]);
if($ha){
$get = file_get_contents("data/statvid.txt");
$b = $get + 1;
file_put_contents("video/R_$b.txt", "$doc_id");
file_put_contents("data/statvid.txt", "$b");
}
}
Please open Telegram to view this post
VIEW IN TELEGRAM
π1
π PHP CODERS UZB π
π΄ Videoni bazaga saqlaydi va bot orqali tasodifiy tarzda yuboriladi! (Via for random β‘οΈ ) if($text == "π Tasodifiy video"){ $nec = file_get_contents("data/statvid.txt"); $phpcodersuzb = rand(1,$nec); $video = file_get_contents("video/R_$phpcodersuzb.txt");β¦
if(!empty($update->message->video)){
$mp4 = true;
$doc_id = $update->message->video->file_id;
}Please open Telegram to view this post
VIEW IN TELEGRAM