Closed Mohsen322 closed 3 years ago
I use this as an example:
if ($data["inline_query"] !== null && $data["inline_query"] != "") {
$query = $data["inline_query"]["query"];
if ( $query == 'chek') {
$option = array( array ( $telegram->buildInlineKeyboardButton("Test", $url="http://google.it"),
$telegram->buildInlineKeyboardButton("Test2", $url="http://google.it"),
$telegram->buildInlineKeyboardButton("shareToOtherChat", "", "", "chek", "", "") ) );
$results= json_encode( [ [ 'type' => "article", 'id'=> "1", 'title'=> "chek inline keybord ", 'description'=> "test ", 'caption'=> "caption" , 'input_message_content'=> ['message_text' => "you can share inline keyboard to other chat"], 'reply_markup'=>['inline_keyboard'=>[ [ ['text'=>"text1",'url'=>'http://google.it'], ['text'=>"text2",'url'=>'http://google.it'], ['text'=>"shareToOtherChat",'switch_inline_query'=>'chek'] ] ]], 'thumb_url'=> "https://avatars2.githubusercontent.com/u/10547598?v=3&s=88", ] ] );
$content =['inline_query_id' => $data["inline_query"]["id"], 'results' => $results ];
$reply = $telegram->answerInlineQuery($content);
}
if (strpos("testText", $query) !== false) {
$results = json_encode(array( array('type' => "gif", 'id'=> "1", 'gif_url' => "http://i1260.photobucket.com/albums/ii571/LMFAOSPEAKS/LMFAO/113481459.gif", 'thumb_url'=>"http://i1260.photobucket.com/albums/ii571/LMFAOSPEAKS/LMFAO/113481459.gif") ) );
$content = array('inline_query_id' => $data["inline_query"]["id"], 'results' => $results );
$reply = $telegram->answerInlineQuery($content);
}
if (strpos("dance", $query) !== false) {
$results = json_encode(array( array('type' => "gif", 'id'=> "1", 'gif_url' => "https://media.tenor.co/images/cbbfdd7ff679e2ae442024b5cfed229c/tenor.gif", 'thumb_url'=>"https://media.tenor.co/images/cbbfdd7ff679e2ae442024b5cfed229c/tenor.gif") ) );
$content = array('inline_query_id' => $data["inline_query"]["id"], 'results' => $results ); $reply =
$telegram->answerInlineQuery($content);
}
}
good temporary Solution :)))
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
im very confused why the buttun i created didnt attaching to inline answers. its work fine with normal methods like sendMessage, sendPhoto and etc. but in inline method i got error. here is my sample code:
I TESTED BUTTON WITH sendMessage and here the result:![image](https://user-images.githubusercontent.com/25117421/76083012-d976f480-5fc1-11ea-836c-5d2018f25868.png)
and got this error in inline mode:
description: Bad Request: field "reply_markup" must be of type Object
the json passed:
[{"type":"article","id":7,"title":"test 2","message_text":"sent keyb 2","reply_markup":"{\"inline_keyboard\":[[{\"text\":\"\\u0641\\u0639\\u0627\\u0644 \\u06a9\\u0646\",\"callback_data\":\"on\"}]]}"}]