/start |
<?php
// Retrieve the Telegram API data
$content = file_get_contents("php://input");
$update = json_decode($content, true);
// Extract necessary data
$message = $update['message'] ?? null;
$chatId = $message['chat']['id'] ?? null;
$text = $message['text'] ?? null;
// Bot response for the /start command
if ($text === '/start') {
$welcomeMessage = "Hello! 👋\n\n";
$welcomeMessage .= "Welcome to my bot! Here's what I can do:\n";
$welcomeMessage .= "- Use commands to interact with me.\n";
$welcomeMessage .= "- Stay tuned for updates and new features.\n\n";
$welcomeMessage .= "Type /help to see all available commands.";
// Send the message to the user
$url = "https://api.telegram.org/bot7859258143:AAGNWgHtNhyRWNKNKCpxK8s2o1usi3FTVYQ/sendMessage";
$postFields = [
'chat_id' => $chatId,
'text' => $welcomeMessage
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
}
?> |
|