PDA

View Full Version : سوال در مورد اینلاین کوئری در بات تلگرام



j68719
دوشنبه 11 اردیبهشت 1396, 11:56 صبح
بات تلگرامی دارم که می خوام اینلایم کوئری ازش بگیرم
@batname queryname


در حالت وب هوک با اینکه وب هوک میده و درست کار می کنه
https://api.telegram.org/bot322361577:AAGhXi4Fl9oGcw9dXHpbKnH7DyDcy2lBmSI/getwebhookinfo
خروجی:



JSON
Raw Data
Headers










ok
true


result




url
"آدرس خودم"



has_custom_certificate
false


pending_update_count
13


allowed_updates




0
"message"


1
"edited_message"


2
"channel_post"


3
"edited_channel_post"


4
"inline_query"


5
"chosen_inline_result"


6
"callback_query"












ولی موقعی که کاربر اینلاین کوئری می نویسه وب هوک رویدای نمیفرسته
ولی وقتی وب هوک غیر فعال می کنم و با گت آپدیت کار می کنم کوئری دارم

<?php

$botToken = " توکنم ";
$webSite = "https://api.telegram.org/bot" . $botToken;

$url = $GLOBALS['webSite'] . "/getupdates" ;
$update1=file_get_contents($url);


//$update1 = file_get_contents("php://input");

$update = json_decode($update1, TRUE);


$update_id =$update["update_id"];

$msg=$update["message"];
$message = $update["message"]["text"];
$chatId = $update["message"]["chat"]["id"];

$edited_message=$update["edited_message"];
$channel_post=$update["channel_post"];
$edited_channel_post=$update["edited_channel_post"];

$inline_query=$update["inline_query"];
$inlineid = $update["inline_query"]["id"];

$chosen_inline_result=$update["chosen_inline_result"];
$callback_query=$update["callback_query"];


$url = $GLOBALS['webSite'] . "/sendMessage?chat_id=" . $chatId . "&text=" . urlencode($inlineid) ;
file_get_contents($url);

$url = $GLOBALS['webSite'] . "/sendMessage?chat_id=" . $chatId . "&text=" . urlencode($update1) ;
file_get_contents($url);


/*
update_id 659119431
inline_query
id "453935124161010938"
from
id 105690007
first_name "آقای بی نام"
username "AqayeBinam"
query "ذابا"
offset ""
*/

?>

اینلاین کوئری را از بات فادر اینیبل هم کردم