Closed mjavidm closed 7 years ago
What do you mean ?
when you forward message with InlineKeyboardButton to other user group channel
only send text of forward message and InlineKeyboardButton not show
I don't think you can do it. In https://core.telegram.org/bots/api#forwardmessage there isn't a field for the keyboard. I guess it's because the chat where you forward the message could not have the bot, so who would respond the InlineKeyboardButton click ?
Can be done I think by inlinequery is possible with 'reply_markup' , But how? :)
'switch_inline_query_current_chat' in 'buildInlineKeyboardButton' !!!
$option = [ [$telegram->buildInlineKeyboardButton( 'text'=> 'text1',)], [$telegram->buildInlineKeyboardButton( 'text'=> 'text2',)], [$telegram->buildInlineKeyboardButton( 'text'=> 'text3',)], [$telegram->buildInlineKeyboardButton( 'text'=> 'shareToOtherChat','switch_inline_query_current_chat'=>'!!??')] ]; $keyb = $telegram->buildInlineKeyBoard($option);
https://core.telegram.org/bots/api#inlinekeyboardmarkup
Idk, do some experiments and see what happens, the documentation of the parameter switch_inline_query_current_chat is really unclear. Start by setting it to an empty string.
//create inline keyboard :
$option = [
[$telegram->buildInlineKeyboardButton( 'text'=> 'text1',)],
[$telegram->buildInlineKeyboardButton( 'text'=> 'text2',)],
[$telegram->buildInlineKeyboardButton( 'text'=> 'shareToOtherChat','switch_inline_query'=>'chek')]
];
$keyb = $telegram->buildInlineKeyBoard($option);
// chek query and create inline keyboard
if ( $result["inline_query"]["query"] == 'chek')
{
$results= json_encode( [
[
'type' => "article",
'id'=> "1",
'title'=> "chek inline keybord ",
'description'=> "test ",
'caption'=> "caption" ,
'input_message_content'=> ['message_text' => "you can share inline keyboard to other chat"],
'reply_markup'=>['inline_keyboard'=>[
[
['text'=>"text1",'url'=>''],
['text'=>"text2",'url'=>''],
['text'=>"shareToOtherChat",'switch_inline_query'=>'chek']
]
]],
'thumb_url'=> "https://avatars2.githubusercontent.com/u/10547598?v=3&s=88",
]
] );
$content =['inline_query_id' => $result["inline_query"]["id"],
'results' => $results
];
$reply = $telegram->answerInlineQuery($content);
}
You need to populate the urls:
'reply_markup'=>['inline_keyboard'=>[
[
['text'=>"text1",'url'=>'http://google.it'],
['text'=>"text2",'url'=>'http://google.it'],
['text'=>"shareToOtherChat",'switch_inline_query'=>'chek']
]
]],
And the inline query id needs to be the one you get from telegram:
$data = $telegram->getData();
$content =['inline_query_id' => $data["inline_query"]["id"], 'results' => $results ];
hi; how to share InlineKeyboardButton to other chat “private”, “group”, “supergroup” or “channel” so that show completely?