<?php
$SirAmiri = "Token"; // توکن ربات تلگرام خود را اینجا قرار دهید
$update = file_get_contents("php://input");
$updateArray = json_decode($update, true);
$chat_id = $updateArray['message']['chat']['id'];
$text = $updateArray['message']['text'];
if ($text == "/start") {
sendMessage($chat_id, "متن مورد نظر خود را برای جستجو ارسال کنید.");
} else {
$response = file_get_contents("https://apis.wiki-api.ir/apis-1/ChatGPT?q=" . urlencode($text));
$web = json_decode($response, true);
if (!empty($web['results'])) {
$CristalTeam = $web['results'];
sendMessage($chat_id, $CristalTeam);
} else {
sendMessage($chat_id, "متاسفانه اطلاعاتی پیدا نشد.");
}
}
function sendMessage($chat_id, $message) {
global $SirAmiri;
$url = "https://api.telegram.org/bot" . $SirAmiri . "/sendMessage";
$postFields = [
'chat_id' => $chat_id,
'text' => $message,
'parse_mode' => 'Markdown'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
}
?>
📁 سورس ربات تلگرامی چت با هوش مصنوعی | Chat GPT
♥️ متصل به api ویکی وبسرویس
👨💻نویسنده : @SirAmiri ذکر منبع اجباری!
🤖 نمونه ربات ران شده : @ChatGptCristalBot
✅ @SourceMr