|
63 | 63 | $content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => $reply);
|
64 | 64 | $telegram->sendMessage($content);
|
65 | 65 | }
|
66 |
| - if ($text == "/git") { |
| 66 | + |
| 67 | + elseif ($text == "/git") { |
67 | 68 | $reply = "Check me on GitHub: https://github.com/Eleirbag89/TelegramBotPHP";
|
68 | 69 | // Build the reply array
|
69 | 70 | $content = array('chat_id' => $chat_id, 'text' => $reply);
|
70 | 71 | $telegram->sendMessage($content);
|
71 | 72 | }
|
72 | 73 |
|
73 |
| - if ($text == "/img") { |
| 74 | + elseif ($text == "/img") { |
74 | 75 | // Load a local file to upload. If is already on Telegram's Servers just pass the resource id
|
75 | 76 | $img = curl_file_create('test.png','image/png');
|
76 | 77 | $content = array('chat_id' => $chat_id, 'photo' => $img );
|
|
81 | 82 | $telegram->downloadFile($file["result"]["file_path"], "./test_download.png");
|
82 | 83 | }
|
83 | 84 |
|
84 |
| - if ($text == "/where") { |
| 85 | + elseif ($text == "/where") { |
85 | 86 | // Send the Catania's coordinate
|
86 | 87 | $content = array('chat_id' => $chat_id, 'latitude' => "37.5", 'longitude' => "15.1" );
|
87 | 88 | $telegram->sendLocation($content);
|
88 | 89 | }
|
| 90 | + |
| 91 | + elseif ($text == "/inlinekeyboard") { |
| 92 | + // Shows the Inline Keyboard and Trigger a callback on a button press |
| 93 | + $option = array( |
| 94 | + array( |
| 95 | + $telegram->buildInlineKeyBoardButton("Callback 1", $url="", $callback_data="1"), |
| 96 | + $telegram->buildInlineKeyBoardButton("Callback 2", $url="", $callback_data="2") |
| 97 | + ) |
| 98 | + ); |
| 99 | + |
| 100 | + $keyb = $telegram->buildInlineKeyBoard($option); |
| 101 | + $content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "This is an InlineKeyboard Test with Callbacks"); |
| 102 | + $telegram->sendMessage($content); |
| 103 | + } |
89 | 104 | }
|
90 | 105 |
|
91 | 106 | ?>
|
0 commit comments