Skip to content

executeCommand with inlinekeyboard #297

@datrix88

Description

@datrix88

Hi guys, thanks for this awesome API for Telegram BOT.

I have a problem when i try to execute a command in CallbackqueryCommand class.
When i click on Inline button nothing is happening.

It's very strange because if i use executeCommand function on my other own command, it works fine.

This is my code:

//StartCommand

[....]

$inline_keyboard = [
            new InlineKeyboardButton(['text' => "Add Category", 'callback_data' => 'add']),
            new InlineKeyboardButton(['text' => "Help", 'callback_data' => 'help'])
];

$data = [
            'chat_id' => $chat_id,
            'text' => $text,
            'reply_markup' => new InlineKeyboardMarkup(['inline_keyboard' => [$inline_keyboard]]),
            'parse_mode' => "MARKDOWN"
];

[....]

//CallBackQueryCommand

[....]

$update = $this->getUpdate();
$callback_query = $update->getCallbackQuery();
$callback_query_id = $callback_query->getId();
$callback_data = $callback_query->getData();
$data['callback_query_id'] = $callback_query_id;

if ($this->getTelegram()->getCommandObject($callback_data)){
      return $this->getTelegram()->executeCommand($callback_data);
}

[....]

How I can resolve this problem?
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions