Advertisement
Mouamle

:3

Feb 28th, 2016
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2.     require 'vendor/autoload.php';
  3.     use Telegram\Bot\Api;
  4.  
  5.     $telegram = new Api('TOKEN', false);
  6.    
  7.        
  8.     $keyboard = [
  9.         ['1', '2', '3'],
  10.         ['4', '5', '6'],
  11.         ['7', '8', '9'],
  12.         ['*', '0', '#']
  13.     ];
  14.    
  15.     $X = file_get_contents("php://input");
  16.     $X = json_decode($X, TRUE);
  17.     if ( $X["message"]["text"] == "4" ) {
  18.         $reply_markup = $telegram->replyKeyboardHide();
  19.  
  20.         $response = $telegram->sendMessage([
  21.             'chat_id' => $X["message"]["chat"]["id"],
  22.             'text' => 'You did it :)',
  23.             'reply_markup' => $reply_markup
  24.         ]);
  25.        
  26.     }else{
  27.        
  28.  
  29.  
  30.     $reply_markup = $telegram->replyKeyboardMarkup([
  31.         'keyboard' => $keyboard,
  32.         'resize_keyboard' => false,
  33.         'one_time_keyboard' => true
  34.     ]);
  35.  
  36.     $response = $telegram->sendMessage([
  37.         'chat_id' => $X["message"]["chat"]["id"],
  38.         'text' => 'What is the number ?',
  39.         'reply_markup' => $reply_markup
  40.     ]);
  41.  
  42.     $messageId = $response->getMessageId();
  43.    
  44.     }
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement