-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
send picture after user press inline button #39
Comments
after you parse the telegram's reply, right before the message content parsing, do: if ($callback_query !== null && $callback_query != "") {
$callback = $telegram->Callback_Data();
if ($callback == "One") {
//send Picture 1
} else if ($callback == "Two") {
//send Picture 2
}
} |
this code above not work |
@Eleirbag89 hi bro. |
The same code works in CowBot (you can try the /inline command and choose the Test2 button). $telegram = new Telegram($bot_id);
$text = $telegram->Text();
$chat_id = $telegram->ChatID();
$data = $telegram->getData();
$callback_query = $telegram->Callback_Query();
if ($callback_query !== null && $callback_query != "") {
$reply = "Callback data value".$telegram->Callback_Data();
$content = array('chat_id' => $telegram->Callback_ChatID(), 'text' => $reply);
$telegram->sendMessage($content);
$content = array('callback_query_id' => $telegram->Callback_ID(), 'text' => $reply, 'show_alert' => true);
$telegram->answerCallbackQuery($content);
}
if ($text == "/inline") {
$option = array( array( $telegram->buildInlineKeyboardButton("Test", $url="http://google.it"), $telegram->buildInlineKeyboardButton($text="Test2","","Callback","") ) );
$keyb = $telegram->buildInlineKeyBoard($option);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "Welcome to CowBot \xF0\x9F\x90\xAE \nPlease type /cowsay or click the Cow button !");
$telegram->sendMessage($content);
} |
very very thanks @Eleirbag89 thanks again, my wrong was i used codes in wrong place. |
hi
first of all ,appreciate for develop this useful class,and thank you share it for us
i have problem in catch inline button and send answer
here is my code
$option = array(
array( $telegram->buildInlineKeyboardButton($text="One","",$callback_data="One",""),$telegram->buildInlineKeyboardButton($text="Two","",$callback_data="Two","") )
$keyb = $telegram->buildInlineKeyBoard($option);
$content = array('chat_id' => $chat_id, 'reply_markup' => $keyb, 'text' => "One Or Two ?");
$telegram->sendMessage($content);
i want send different picture after user press (One or Two) buttons
how can i do it ?
Regards,Frank
The text was updated successfully, but these errors were encountered: