these two things like this, only the "response" method works for me --- this "$message = isset($update['message']) ? $update['message'] : "";
$messageId = isset($message['message_id']) ? $message['message_id'] : "";
$chatId = isset($message['chat']['id']) ? $message['chat']['id'] : "";
$firstname = isset($message['chat']['first_name']) ? $message['chat']['first_name'] : "";
$lastname = isset($message['chat']['last_name']) ? $message['chat']['last_name'] : "";
$username = isset($message['chat']['username']) ? $message['chat']['username'] : "";
$date = isset($message['date']) ? $message['date'] : "";
$text = isset($message['text']) ? $message['text'] : "";
$text = trim($text);
$text = strtolower($text);
header("Content-Type: application/json");
$response = '';
if(strpos($text, "/start") === 0 || $text=="ciao")
{
$response = "Ciao $firstname, benvenuto!";
}
elseif($text=="buongiorno")
{
$response = "Ciao $firstname, buongiorno";
}
elseif($text=="buonasera")
{
$response = "Ciao $firstname, buonasera!";
}
else
{
}
$parameters = array('chat_id' => $chatId, "text" => $response);
$parameters["method"] = "sendMessage";
echo json_encode($parameters);" this is ok
does your bot work with /start ?
with all respect, this is not readable, Please try to use nekobin.com
Обсуждают сегодня