TelegramBot / Api

Native PHP Wrapper for Telegram BOT API
MIT License
1.09k stars 324 forks source link

How do i resize reply keyboard? #237

Closed Mccay closed 4 years ago

Mccay commented 4 years ago

Buttons appear with fixed size, no matter what text is involved. How do i resize them?

iGusev commented 4 years ago

You can use code like this:

// start command
$bot->command('start', function (Message $message) use ($bot) {
    /** @var BotApi $bot */

    $bot->sendMessage(
        $message->getChat()->getId(),
        'Welcome text here',
        'html',
        false,
        null,
        new ReplyKeyboardMarkup(
            [
                [
                    ['text' => 'my button 1'],
                ]
            ],
            false,
            true
        )
    );
});

More info about ReplyKeyboardMarkup: https://github.com/TelegramBot/Api/blob/master/src/Types/ReplyKeyboardMarkup.php#L68 https://core.telegram.org/bots/api#replykeyboardmarkup