Comments (7)
What do you mean ?
from telegrambotphp.
when you forward message with InlineKeyboardButton to other user group channel
only send text of forward message and InlineKeyboardButton not show
from telegrambotphp.
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 ?
from telegrambotphp.
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
from telegrambotphp.
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.
from telegrambotphp.
//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);
}
from telegrambotphp.
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 ];
from telegrambotphp.
Related Issues (20)
- Unable to get phone number HOT 1
- Telegram::getChatMembersCount() method
- [BUG]
- Hi~~ @Eleirbag89 pls delete this issue,thanks!
- Web Apps HOT 8
- UpdateCount[BUG] HOT 2
- payment function HOT 1
- you have any video for this bot like tutorial ? HOT 1
- How to make wait for answer HOT 2
- Can you create .phar file for this project HOT 9
- [BUG]
- ErrorException Undefined array key "message" when using funtion UserID() HOT 3
- Formatting options HOT 3
- sendMediaGroup not working! HOT 1
- How to get user_id of the message of a user I reply to? HOT 1
- Add API Support for up to API 6.9 (22.09.2023) HOT 1
- Please Add Forward From Username HOT 1
- My button not a have actions
- how to send sticker HOT 2
- Failed to connect to api.telegram.org port 443 after 21043 ms: Timed out HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telegrambotphp.