Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterized Callback Query Listeners #66

Open
awohsen opened this issue Apr 16, 2022 · 2 comments
Open

Parameterized Callback Query Listeners #66

awohsen opened this issue Apr 16, 2022 · 2 comments

Comments

@awohsen
Copy link
Contributor

awohsen commented Apr 16, 2022

Hi, hope someone start and renew this project soon; btw it would be great if callback query data, be parametrized like texts as well.

Also right now for callback query data listeners we should provide an array, idk its for which case but providing single parametrized text would help a lot!

Thanks for improving this great async bot framework. 💗

@devblack
Copy link
Contributor

devblack commented May 15, 2022

You can use the message_reply_to of the callback "only if your bot reply to and message".

example:

client --> /some_command product-3
bot --> reply to this command with the inline button.
client --> click in the inline button.
onCbQueryData listen that event then you get the text of the reply message
$reply_to = $ctx->getCallbackQuery()->getMessage()->getReplyToMessage()->getMessage()->getText();.

@awohsen
Copy link
Contributor Author

awohsen commented May 15, 2022

Yes, but it's only one aspect and way to do it despite the features that the listener provides.

Imagine an inline menu that has those products in and when the user chooses a product, the bot provides him another menu with inline buttons where each has its own functions related to the product and this menu is the same for all products the difference is the product code hidden in the callback query data example: buy-product3.

It's not impossible right now thanks to onCbQuery, but it catches all CbQueries...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants