irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
https://telegram-bot-sdk.com
BSD 3-Clause "New" or "Revised" License
3.02k stars 668 forks source link

Handling conversations and working with database #364

Closed vmohir closed 7 years ago

vmohir commented 7 years ago

Hello. Does telegram bot sdk support database? How can I handle conversations? For example I have a command "/contact" which displays the message "Please enter your message:". After that the user should enter the contact message. How can I understand this message?

irazasyed commented 7 years ago

The SDK has got nothing to do with how you store the data of your bot. But you're free to use anything to store in or outbound communication between your users and the bot.

In other words, you can use a database yes!

As far as the conversations are concerned, you can use either cache or store in a database the last query of the user and your Q and then accordingly map based on the incoming update.

Take a look at this package: https://github.com/telegram-bot-kit/convo (It's not released and possibly outdated but use it for reference purposes).