I have this code :
<?php
$update = json_decode(file_get_contents('php://input'), TRUE);
$botToken = "*****";
$botAPI = "https://api.telegram.org/bot" . $botToken;
// Check if callback is set
if (isset($update['callback_query'])) {
// Reply with callback_query data
$data = http_build_query([
'text' => 'Selected language: ' . $update['callback_query']['data'],
'chat_id' => $update['callback_query']['from']['id']
]);
$url = $botAPI . "/sendMessage?{$data}";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
}
// Check for normal command
$msg = $update['message']['text'];
if ($msg === "/start") {
// Create keyboard
$data = http_build_query([
'text' => 'Please select language:',
'chat_id' => $update['message']['from']['id']
]);
$keyboard = json_encode([
"inline_keyboard" => [
[
[
"text" => "english",
"callback_data" => "english"
],
[
"text" => "russian",
"callback_data" => "russian"
]
]
]
]);
// Send keyboard
$url = $botAPI . "/sendMessage?{$data}&reply_markup={$keyboard}";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
curl_close($curl);
}
?>
It works as I expected, in terms of showing menu and replying message.
But, there's something annoying to me: it keeps showing a loading icon and in few minutes later, there's a message that shows 'not responding'.
How can I remove this loading icon to prevent the 'not responding' message?
Thank you.