-
-
Notifications
You must be signed in to change notification settings - Fork 955
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
Change the logic of creating the Keyboard and Keyboard Buttons #1344
Comments
EDIT: Ignore my example below, the problem here is that an inline keyboard object can't be created with just a text element, as the validation that expects the i.e. this fails: @TiiFuchs Maybe we should skip this validation entirely and let the Telegram API complain about it? I understand what you mean, but don't see such a big difference between the two snippets, as you could inline the new button objects too, which would look pretty much the same: $keyboardInline = new InlineKeyboard([]);
$keyboardInline->addRow(
(new InlineKeyboardButton('Тестовая кнопка #1'))->setCallbackData(json_encode([
'name' => 'test_button_1',
'show' => true,
])),
(new InlineKeyboardButton('Тестовая кнопка #2'))->setCallbackData(json_encode([
'name' => 'test_button_2',
'show' => true,
]))
); Also, in your example you're overwriting the @TiiFuchs What do you think? |
@noplanman I agree. I think we shouldn’t do any validation within this class and keep that to the API servers. So we should remove the validation. |
Someone willing to remove it? ;D |
@TiiFuchs Would make sense to kill it before the next release, what do you think? |
Now is as good as anytime. |
It is very inconvenient that it is impossible to create an inline button with empty parameters in order to operate on it in the future and you have to manually translate the callback_data array every time, so you have to do this:
I think it would be more comfortable and convenient:
without the need to create a new button object each time, specifying all parameters at once and without manual json_encode
The text was updated successfully, but these errors were encountered: