|
20 | 20 | $text = $telegram->Text();
|
21 | 21 | $chat_id = $telegram->ChatID();
|
22 | 22 |
|
| 23 | +// Test CallBack |
| 24 | +$callback_query = $telegram->Callback_Query(); |
| 25 | +if ($callback_query !== null && $callback_query != "") { |
| 26 | + $reply = "Callback value ".$telegram->Callback_Data(); |
| 27 | + $content = array('chat_id' => $telegram->Callback_ChatID(), 'text' => $reply); |
| 28 | + $telegram->sendMessage($content); |
| 29 | + |
| 30 | + $content = array('callback_query_id' => $telegram->Callback_ID(), 'text' => $reply, 'show_alert' => true); |
| 31 | + $telegram->answerCallbackQuery($content); |
| 32 | +} |
| 33 | + |
| 34 | +//Test Inline |
| 35 | +$data = $telegram->getData(); |
| 36 | +if ($data["inline_query"] !== null && $data["inline_query"] != "") { |
| 37 | + // GIF Examples |
| 38 | + if (strpos("testText", $query) !== false) { |
| 39 | + $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") ) ); |
| 40 | + $content = array('inline_query_id' => $data["inline_query"]["id"], 'results' => $results ); |
| 41 | + $reply = $telegram->answerInlineQuery($content); |
| 42 | + } |
| 43 | + |
| 44 | + if (strpos("dance", $query) !== false) { |
| 45 | + $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") ) ); |
| 46 | + $content = array('inline_query_id' => $data["inline_query"]["id"], 'results' => $results ); |
| 47 | + $reply = $telegram->answerInlineQuery($content); |
| 48 | + } |
| 49 | +} |
| 50 | + |
23 | 51 | // Check if the text is a command
|
24 | 52 | if(!is_null($text) && !is_null($chat_id)){
|
25 | 53 | if ($text == "/test") {
|
|
0 commit comments