E
E
Evgeny2021-10-04 00:43:16
PHP
Evgeny, 2021-10-04 00:43:16

Why is the result not displayed in inline mode?

I'm new to php and just started to learn Inline Mode for bot, I have a problem with InlineQueryResultArticle method

Connected via BotFather Inline Mode, bot should display message after typing @botname, but I can't figure out why it's not displayed

615a23d70a7f1499299875.png

function sendRequest($method, $post = '') {
$ch = curl_init('https://api.telegram.org/bot' . BOT_TOKEN . '/' . $method);

if ($post) {
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$data = curl_exec($ch);

curl_close($ch);
return $data;
}

if (strpos($message, "@secret_group_message_bot secret") === 0) {
$post = [
    'type' => 'article',
    'id' => 1,
    'title' => 'aaa',
    'description' => 'bbb',
    'input_message_content' => [
        'message_text' => 'ccc'
        ],
    $inlinekeyboard = [],
    'reply_markup' => inline_keyboard($inlinekeyboard)
    ];
    
sendRequest('InlineQueryResultArticle', $post);
}


Perhaps I didn’t understand correctly how the method works or I forgot to add something somewhere, since there were few examples of this method and all of them are approximately similar to what I wrote

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2021-10-04
@shurshur

Everything works great.
615a38bc692d3060148638.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question