telegram-bot-sdk icon indicating copy to clipboard operation
telegram-bot-sdk copied to clipboard

How send Inline Keyboard Markup?

Open alekssamos opened this issue 6 years ago • 8 comments

In the documentation, I only found how to send ReplyKeyboardMarkup. And InlineKeyboardMarkup is not.

Example AB7DF9B6-0EF2-42E0-84D1-2C50FEAA48C1

alekssamos avatar Sep 08 '19 06:09 alekssamos

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

welcome[bot] avatar Sep 08 '19 06:09 welcome[bot]

@alekssamos what version are you using?

yongkyali avatar Sep 18 '19 08:09 yongkyali

@alekssamos what version are you using?

@yongkylie v2.2.0

alekssamos avatar Sep 19 '19 17:09 alekssamos

Code example on 2.*

$inline_keyboard[] = [
                    [
                        'text' =>'title',
                        'callback_data' => 'some data'
                    ]
                ];

$reply_markup = Telegram::replyKeyboardMarkup([
                'inline_keyboard' => $inline_keyboard,
                'resize_keyboard' => true
            ]);

$response = Telegram::sendMessage([
                'text' => 'Message',
                'reply_markup' => $reply_markup,
                'chat_id' => $chatId
            ]);

SelimTavukcuoglu avatar Oct 11 '19 18:10 SelimTavukcuoglu

Method [replyKeyboardMarkup] does not exist.

MrThursby avatar May 24 '21 16:05 MrThursby

@MrThursby +1

qwertynik avatar Jun 10 '21 12:06 qwertynik

@qwertynik This method was removed (or renamed or moved), but the docs were not updated... To create a keyboard, use the Telegram\Bot\Keyboard class;

MrThursby avatar Jun 15 '21 11:06 MrThursby

Example

class ExampleCommand extends Telegram\Bot\Commands\Command

public function handle()
  {
      $this->replyWithMessage([
          'text' => 'Hello',
          'reply_markup' =>
              Keyboard::make([
              'inline_keyboard' => [
                  [
                      [
                          'text' => 'ok',
                          'callback_data' => 'data_ok',
                      ],
                      [
                          'text' => 'noO',
                          'callback_data' => 'data_noO',
                      ],
                  ],
              ],
              'resize_keyboard' => true,
          ])
      ]);
  }

FromSi avatar Aug 31 '21 09:08 FromSi