-
-
Notifications
You must be signed in to change notification settings - Fork 955
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
Launch other command on inline keyboard button click #251
Comments
At the moment there is no clean way to execute a subcommand. Seems like one of those obvious things that one should just be able to do, right? If you need a more thorough explanation, let me know! @akalongman @MBoretto @jacklul // In the command's execute(), if we want to send "/echo testing".
// Note that we explicitly need to create the EchoCommand object!
$ud = clone $this->getUpdate();
\Tests\TestHelpers::setObjectProperty($ud->getMessage(), 'text', '/echo testing');
(new EchoCommand($this->telegram, $ud))->preExecute(); |
You can instead be sending /reply_parameter command and then explode "_" and execute first part then inside reply command extract the second part and use it as a parameter, thats how i did contact/reply system in my bots. So I have a contact command that puts inline button under user message: 'text' => "Reply",
'callback_data' => 'reply_' . $message->getFrom()->getId() then in callbackquerycommand I have this simple thing: $data = $callback_query->getData();
$command = explode('_', $data);
$command = $command[0];
if ($this->getTelegram()->getCommandObject($command)) {
return $this->getTelegram()->executeCommand($command);
} and then on top of my reply command i have: $testtext = explode('reply_', $command);
$text = $testtext[1]; hope this helps |
First of all thanks for great job!
I have created callbackquery command where I'm checking the callback_data for a string like "order:123".
I need to start an other command such as
/reply 123
.But when I'm trying
I'm getting following exception:
Does it a way to do it?
The text was updated successfully, but these errors were encountered: