Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get data after clicking button ? #9

Open
bamboriz opened this issue Aug 19, 2018 · 1 comment
Open

How to get data after clicking button ? #9

bamboriz opened this issue Aug 19, 2018 · 1 comment

Comments

@bamboriz
Copy link

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);

});

@BangAchil
Copy link

BangAchil commented Jan 21, 2019

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);

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants