You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've not looked deeply into this yet, but since that data gets passed via a message, you should be able to get it inside your GenericmessageCommand class. Have you tried this?
class GenericmessageCommand extends SystemCommand
{
publicfunctionexecute(): ServerResponse
{
$data = $this->getMessage()?->getWebAppData()?->getData();
// check if $data isn't null and do something with it.
}
}
But I think the code has an issue (not only for Web Apps.
If $type is not 'command', this line makes it so $command_tmp always contains a string with the first character in upper case, and all the other characters in lowercase (for example: 'web_app_data' → 'Webappdata').
But this line makes it so all the command handlers have a snake_case syntax (for example: 'WebAppDataCommand' → 'web_app_data').
That way, when $type !== 'command', we'll NEVER have a match between command names derived from messages and command classes here.
🐞 Bug Report
Required Information
RAW update (if available)
Summary
We can launch Web Apps by using the
web_app
key inKeyboard
orInlineKeyboard
reply markups.Web Apps can send some data back to the bot (see the JSON above).
The problem is that (AFAIK) there's no way to create a command that handles it.
$command_tmp
contains 'Webappdata`WebAppDataCommand
class, the command identifier isweb_app_data
WebappdataCommand
class, the command identifier iswebappdata
Because neither
web_app_data
norwebappdata
are the same asWebappdata
,we can't create a command that handles the update.The text was updated successfully, but these errors were encountered: