V
V
vladislav9972021-11-19 12:15:55
API
vladislav997, 2021-11-19 12:15:55

How to resize inline buttons in Telegram bot?

Tell me how to resize inline (not reply) buttons in Telegram bot? The doc doesn't say anything at all about resizing exactly inline buttons

Code

foreach ($sections as $section) {
    $arrKeyboard[] = [
        'text' => $section->getTitle(),
        'callback_data' => '....'
    ];
}

$keyboard = new \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup([$arrKeyboard]);
$telegramBot->sendMessage($message->getChat()->getId(), $answer, 'markdown', false, null, $keyboard);

What does it look like
61976af00ae65069312062.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MinTnt, 2021-11-19
@vladislav997

resize - available only for ReplyKeyboardMarkup
As you can see in the documentation cutout below, there are no such settings.
61977d593740c850604942.png
So for the best display of the text of the buttons, it is better to make them in several rows.
To do this, instead of a view list,

[ [{"text": ..., "callback_data": "...."}, {"text": ..., "callback_data": "...."}, {"text": ..., "callback_data": "...."}] ]

change to look
[ [{"text": ..., "callback_data": "...."}], [{"text": ..., "callback_data": "...."}], [{"text": ..., "callback_data": "...."}] ]

S
Soho, 2015-03-15
@focuspro

what site? on what engine?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question