GithubHelp home page GithubHelp logo

Comments (7)

Eleirbag89 avatar Eleirbag89 commented on September 28, 2024

What do you mean ?

from telegrambotphp.

mjavidm avatar mjavidm commented on September 28, 2024

when you forward message with InlineKeyboardButton to other user group channel
only send text of forward message and InlineKeyboardButton not show

from telegrambotphp.

Eleirbag89 avatar Eleirbag89 commented on September 28, 2024

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.

mjavidm avatar mjavidm commented on September 28, 2024

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.

Eleirbag89 avatar Eleirbag89 commented on September 28, 2024

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.

mjavidm avatar mjavidm commented on September 28, 2024
//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.

Eleirbag89 avatar Eleirbag89 commented on September 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.