irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.

Home Page:https://telegram-bot-sdk.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Method [replyKeyboardMarkup] does not exist.

amirhshokri opened this issue · comments

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)

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.

commented

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

$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
      ])
  ]);

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

#497 (comment)

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