defstudio / telegraph

Telegraph is a Laravel package for fluently interacting with Telegram Bots
MIT License
674 stars 116 forks source link

Implementing Language Selection in an Existing Chat System: Seeking Advice #575

Closed Taurinz359 closed 5 months ago

Taurinz359 commented 5 months ago

Hello everyone,

I'm facing a challenge with expanding the functionality of our chat system by adding a language field. Currently, I have a legacy project where users are already registered and active. My task is to ensure that the entry point of the chat system checks whether the user has set a language preference. If not, it should prompt them with a keyboard to select their preferred language and not proceed further until a language is chosen.

I've attempted to override the inherited handle method, but due to its encapsulation within a try-catch block, the pipeline continues execution instead of halting. Additionally, I've considered using middleware, but this approach results in duplicate database queries when creating a new user, which is not desirable.

Could anyone provide guidance on how to approach this situation effectively? Your insights and suggestions would be greatly appreciated.