Eleirbag89 / TelegramBotPHP

A very simple PHP Telegram Bot API for sending messages.
http://eleirbag89.github.io/TelegramBotPHP
MIT License
800 stars 340 forks source link

how to make questions answered by typing on the keyboard #199

Closed oxygenfox closed 4 years ago

oxygenfox commented 4 years ago

how to make questions answered by typing on the keyboard

example bot: Write your feedback here

user typing : This Good!

Bot: Okay, your answer will be sent to the owner

I made a specific function for sending messages to the idchat owner but I had difficulty making the situation so that the user could answer his question by typing

molotoksoftware commented 4 years ago

You can add reply_markup parameter to sendMessage function like this

                    'chat_id' => $data['message']['chat']['id'],
                    'text'    => 'Enter your ID',
                    'reply_markup' => [
                        'force_reply' => true,
                        'selective'   => true,
                    ]

When user answer on this question you will get message and do some logic.

Another way you can build conversation in DB, with statuses.

oxygenfox commented 4 years ago

thanks im solved in here, i use database to save question from user on final case i call all answer from user to my Id chat