core: Don't send message after selecting the button help me please
- Operating system: Linux srv-plesk20.ps.kz 3.10.0-514.21.2.el7.x86_64 #1 SMP Tue Jun 20 12:24:47 UTC 2017 x86_64
- PHP version: 7.0.21 (64bit); cgi-fcgi; Linux
- Using MySQL database: no
- Update Method: Webhook
- Self-signed certificate: no
I have 2 commands InfoCallbackqueryCommand.php
<?php
namespace Longman\TelegramBot\Commands\SystemCommands;
use Longman\TelegramBot\Commands\SystemCommand;
use Longman\TelegramBot\Request;
class InfoCallbackQueryCommand extends SystemCommand
{
protected $name = 'callbackquery';
/**
* @var string
*/
protected $description = 'Reply to callback query';
/**
* @var string
*/
protected $version = '1.1.0';
/**
* Command execute method
*
* @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException
*/
public function execute()
{
$update = $this->getUpdate();
$callback_query = $update->getCallbackQuery();
$callback_query_id = $callback_query->getId();
$callback_data = $callback_query->getData();
return Request::editMessageReplyMarkup([
'chat_id' => $update->getMessage()->getChat()->getId(),
'message_id' => $this->getMessage()->getMessageId(),
'text' => 'test'
]);
}
}
and MenuCommand.php
<?php
namespace Longman\TelegramBot\Commands\UserCommands;
use Longman\TelegramBot\Commands\UserCommand;
use Longman\TelegramBot\Entities\InlineKeyboard;
use Longman\TelegramBot\Request;
class MenuCommand extends UserCommand
{
protected $name = 'menu';
protected $description = 'Show inline keyboard';
protected $usage = '/menu';
protected $version = '1.0.0';
public function execute()
{
$chat_id = $this->getMessage()->getChat()->getId();
$inline_keyboard = new InlineKeyboard([
['text' => 'Помощь', 'callback_data' => 'callbackquery'],
['text' => 'Информация', 'callback_data' => '!info'],
], [
['text' => 'Начало', 'callback_data' => '!start'],
]);
$data = [
'chat_id' => $chat_id,
'text' => 'Выберите одну из предложенных команд',
'reply_markup' => $inline_keyboard,
];
return Request::sendMessage($data);
}
}
And I do not understand how to as after pressing to send a message to the same chat. my bot @testMnpBot
Thanks!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (7 by maintainers)
This is my inlineKeyboard:
and this i put in my
CallbackqueryCommand.php
that work fine but 3 button make same response if i want make different response for each button i make code with: case1 case2 ecc but in the same file CallbackqueryCommand.php or in hook.php thanks very much
something like that:
Thanks all, it’s realy worked!!! i just remove this:
in my hook.php and please, close this 😃 👍