Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'vendor/autoload.php';
- use Telegram\Bot\Api;
- $telegram = new Api('TOKEN', false);
- $keyboard = [
- ['1', '2', '3'],
- ['4', '5', '6'],
- ['7', '8', '9'],
- ['*', '0', '#']
- ];
- $X = file_get_contents("php://input");
- $X = json_decode($X, TRUE);
- if ( $X["message"]["text"] == "4" ) {
- $reply_markup = $telegram->replyKeyboardHide();
- $response = $telegram->sendMessage([
- 'chat_id' => $X["message"]["chat"]["id"],
- 'text' => 'You did it :)',
- 'reply_markup' => $reply_markup
- ]);
- }else{
- $reply_markup = $telegram->replyKeyboardMarkup([
- 'keyboard' => $keyboard,
- 'resize_keyboard' => false,
- 'one_time_keyboard' => true
- ]);
- $response = $telegram->sendMessage([
- 'chat_id' => $X["message"]["chat"]["id"],
- 'text' => 'What is the number ?',
- 'reply_markup' => $reply_markup
- ]);
- $messageId = $response->getMessageId();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement