irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
https://telegram-bot-sdk.com
BSD 3-Clause "New" or "Revised" License
3.04k stars 671 forks source link

Method [replyKeyboardMarkup] does not exist. #1092

Closed amirhshokri closed 8 months ago

amirhshokri commented 1 year ago

Hi, I'm using this package with Laravel. According to the link below:

https://telegram-bot-sdk.com/docs/guides/keyboards?language=laravel#reply-keyboard-markup

the method 'replyKeyboardMarkup' must exist and usable. But when i use it as mentioned in the example, following error appears:

Method [replyKeyboardMarkup] does not exist. {"exception":"[object] (BadMethodCallException(code: 0): Method [replyKeyboardMarkup] does not exist. at /.../vendor/irazasyed/telegram-bot-sdk/src/Api.php:127)

amirhshokri commented 1 year ago

For now, it is usable like this:

$keyboard = [
    ['7', '8', '9'],
    ['4', '5', '6'],
    ['1', '2', '3'],
    ['0']
];

 Telegram::sendMessage([
      'chat_id' => $updates->getChat()->getId(),
      'text' => 'Hello World',
      'reply_markup' => json_encode([
          'keyboard' => $keyboard,
          'resize_keyboard' => true,
          'one_time_keyboard' => true
      ])
  ]);

Please fix this issue in later updates.

echo-LuGuang commented 1 year ago

目前,它可以像这样使用:

$keyboard = [
    ['7', '8', '9'],
    ['4', '5', '6'],
    ['1', '2', '3'],
    ['0']
];

 Telegram::sendMessage([
      'chat_id' => $updates->getChat()->getId(),
      'text' => 'Hello World',
      'reply_markup' => json_encode([
          'keyboard' => $keyboard,
          'resize_keyboard' => true,
          'one_time_keyboard' => true
      ])
  ]);

请在以后的更新中修复此问题。

https://github.com/irazasyed/telegram-bot-sdk/issues/497#issuecomment-623721743

irazasyed commented 8 months ago

3.x has Keyboard. Docs have a mistake, it's for 2.x. Thanks for highlighting.