505
if ($update_type == 'bot_started') {
$user_id = $update->user_id;
$chatId = $update->chat_id;
$name = $update->user->name;
$username = $update->user->username;
} elseif ($update_type == 'message_created') {
$user_id = $message->sender->user_id;
$chatId = $message->recipient->chat_id;
$name = $message->sender->name;
$username = $message->sender->username;
if (strpos($text, 'كول ') === 0) {
$responseText = trim(substr($text, strlen('كول ')));
$responseText = preg_replace('/https?:\/\/\S+|www\.\S+/', '', $responseText);
$responseText = preg_replace('/@\w+/', '', $responseText);
$responseText = trim($responseText);
if (!empty($responseText)) {
$tamtam->bot($chatId, [
'text' => $responseText,
'format' => 'markdown',
'link' => [
'type' => 'reply',
'mid' => $message_id
],
]);
}
}
}