inline button "back" and delete inline button messages
❓ Support Question
I can't remember the function that returns Back when the inline button is pressed, there is no need to use something complicated there.
It is also not possible to delete messages with inline buttons.
Thank you very much for your time.
What is your question here? 🤔
What is your question here? 🤔
need to make the back button inline
That‘s still not a question…?
HI
It is Possible to delete messages with Inline buttons, i do it myself
In your Callbackquery you will need the following:
$deldata = [
'chat_id' => $chat_id,
'message_id' => $message_id
];
Request::deleteMessage($deldata);
You can get the nessesary ID's with
$callback_query = $this->getCallbackQuery();
$message = $callback_query->getMessage();
$message_id = $message->getMessageId();
$chat = $message->getChat();
$chat_id = $chat->getId();
For a "Back" Button there are different solutions, depending how your code is build
If you have send another inline keyboard via Callbackquery, you simply need to call that menu again If you want to trigger the /command again you will need to add two things:
In CallbackqueryCommand.php:
//Your Code to check to check if the Back Button was pressed
return $this->telegram->executeCommand('command');
In Your Command file you need to check if a Callbackquery is present to aquire the ChatID from the callbackquery
if ($this->getCallbackQuery() !== null) {
$message = $this->getCallbackQuery()->getMessage();
$chat =$this->getCallbackQuery()->getMessage()->getChat();
$user = $chat;
$chat_id = $this->getCallbackQuery()->getMessage()->getChat()->getId();
$user_id = $chat_id;
}
else {
$message = $this->getMessage();
$message_id = $message->getMessageId();
$chat_id = $message->getChat()->getId();
$text = trim($message->getText(true));
}
If you have further Questions please ask them. Maybe with a bit more detail and Information ;)
Closed since there was no further interaction.