botman / driver-telegram

BotMan Telegram Driver
MIT License
88 stars 75 forks source link

Botman with Telegram driver removes Keyboard from chat #29

Closed adellantado closed 4 years ago

adellantado commented 6 years ago

When I try to send message like this:

bot->reply('blabla', [
            'reply_markup' => json_encode(Collection::make([
            'inline_keyboard' => [ ... ]
        ]))
]);

After click on a button , all keyboard will be removed instantly.

I found these lines in listen() method:

               if (method_exists($this->getDriver(), 'messagesHandled')) {
                    $this->getDriver()->messagesHandled();
                }

Which calls removeInlineKeyboard(). Is it possible to add some kind of manual switcher for this feature? Or better just automatically control if it was a Question, than removeInlineKeyboard, otherwise - don't?

Versions: "botman/botman": "2.1.10", "botman/driver-telegram": "1.4",

Lloople commented 6 years ago

You can extend TelegramDriver and change the behaviour of messagesHandled

adellantado commented 6 years ago

Indeed, why I didn't come up with it. Thanks, man!

aliwesome commented 4 years ago

@adellantado I found easy solution for that, according to config that has been used in TelegramDriver class, you can easily set 'hideInlineKeyboard' => false, in config/botman/telegram.php that would be the answer.