Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: not work "Reply Keyboard Markup" #99

Open
surnin opened this issue Dec 13, 2023 · 1 comment
Open

[Bug]: not work "Reply Keyboard Markup" #99

surnin opened this issue Dec 13, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@surnin
Copy link

surnin commented Dec 13, 2023

PHP version

8.2

Telegram Bot SDK version

3.13

Laravel version (if any)

I don't use it

What happened?

I used the keyboard example from the documentation and it doesn't work.

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

$reply_markup = $telegram->replyKeyboardMarkup([
    'keyboard' => $keyboard,
    'resize_keyboard' => true,
    'one_time_keyboard' => true
]);

$response = $telegram->sendMessage([
    'chat_id' => 'CHAT_ID',
    'text' => 'Hello World',
    'reply_markup' => $reply_markup
]);

$messageId = $response->getMessageId();

My script stops at the line

$reply_markup = $telegram->replyKeyboardMarkup([
    'keyboard' => $keyboard,
    'resize_keyboard' => true,
    'one_time_keyboard' => true
]);

if you comment out this line, then the script works fine.

Code To Reproduce the bug

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

$reply_markup = $telegram->replyKeyboardMarkup([
    'keyboard' => $keyboard,
    'resize_keyboard' => true,
    'one_time_keyboard' => true
]);

$response = $telegram->sendMessage([
    'chat_id' => 'CHAT_ID',
    'text' => 'Hello World',
    'reply_markup' => $reply_markup
]);

$messageId = $response->getMessageId();

Error stacktrace (if any)

No response

Additional Context

No response

Possible Solution

To continue using the sdk, I have to insert the keyboard in json format.

        $telegram->sendMessage(['chat_id' => $chat_id, 'text' => $reply, 'reply_markup' => json_encode([
            'keyboard' => $keyboard,
            'resize_keyboard' => true,
            'one_time_keyboard' => true
        ])]);
@surnin surnin added the bug Something isn't working label Dec 13, 2023
@Raxort
Copy link

Raxort commented Jan 25, 2024

Same here. Was trying to set up the keyboard using the guidelines in the documentation, but got the message:

Method [replyKeyboardMarkup] does not exist.

Fix the bug, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants