phptelebot
phptelebot copied to clipboard
How to get data after clicking button ?
Hi, I know it's been a long time but I was hoping you could help me out. How do I get the "/whoami" commands executed when the buttons are clicked. Thanks
// inline keyboard $bot->cmd('/keyboard', function () { $keyboard[] = [ ['text' => 'PHPTelebot', 'callback_data' => '/whoami'], ['text' => 'Haru bot', 'callback_data' => '/whoami'], ]; $options = [ 'reply_markup' => ['inline_keyboard' => $keyboard], ];
return Bot::sendMessage('Inline keyboard', $options);
});
Hi, I know it's been a long time but I was hoping you could help me out. How do I get the "/whoami" commands executed when the buttons are clicked. Thanks
// inline keyboard $bot->cmd('/keyboard', function () { $keyboard[] = [ ['text' => 'PHPTelebot', 'callback_data' => '/whoami'], ['text' => 'Haru bot', 'callback_data' => '/whoami'], ]; $options = [ 'reply_markup' => ['inline_keyboard' => $keyboard], ];
return Bot::sendMessage('Inline keyboard', $options);
});
using mw keyboard button $bot->cmd('/button', function ($pesan) { $info = bot::message(); $id = $info['chat']['id']; $text = "Working";
$keyboard = array( "keyboard" => array(array(array( "text" => "/button"
), array( "text" => "contact", "request_contact" => true // This is OPTIONAL telegram button
), array( "text" => "location", "request_location" => true // This is OPTIONAL telegram button
)
)), "one_time_keyboard" => true, // Can be FALSE (hide keyboard after click) "resize_keyboard" => true // Can be FALSE (vertical resize) );
$postfields = [
'reply_markup' => json_encode($keyboard)
];
Bot::sendMessage($text, $postfields);
});