HEX
Server: LiteSpeed
System: Linux cms560.hostnegar.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: ngbycoco (1137)
PHP: 8.2.29
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, mail
Upload Files
File: /home/ngbycoco/www/wp-content/bo/bot.php
<?php
require_once __DIR__ . '/config.php';

$update = json_decode(file_get_contents('php://input'), true);
if (!$update) die('Invalid');

if (isset($update['message'])) {
    $chatId = $update['message']['chat']['id'];
    $text = $update['message']['text'] ?? '';

    if (strpos($text, '/start') === 0) {
        $parts = explode(' ', $text);
        $ref = $parts[1] ?? '';
        
        // ===== ساخت لینک مینی‌اپ =====
        $appUrl = 'https://' . $_SERVER['HTTP_HOST'] . '/wp-content/bo/index.php';
        if ($ref && strpos($ref, 'ref_') === 0) {
            $code = substr($ref, 4);
            $appUrl .= '?ref=' . $code;
        }
        
        $msg = "✦ *TonTastic*\n\n";
        $msg .= "Welcome to TonTastic!\n";
        $msg .= "Mine TTC tokens and earn rewards.\n\n";
        
        if ($ref && strpos($ref, 'ref_') === 0) {
            $code = substr($ref, 4);
            $msg .= "🎯 You were invited with referral code: *$code*\n";
            $msg .= "You'll get bonus TTC when you start mining!\n\n";
        }
        
        $msg .= "🚀 Click the button below to start mining!";
        
        $url = "https://api.telegram.org/bot" . BOT_TOKEN . "/sendMessage";
        
        // ===== درست ترین روش ارسال WebApp =====
        $data = [
            'chat_id' => $chatId,
            'text' => $msg,
            'parse_mode' => 'Markdown',
            'reply_markup' => json_encode([
                'inline_keyboard' => [
                    [
                        [
                            'text' => '🚀 Open App',
                            'web_app' => [
                                'url' => $appUrl
                            ]
                        ]
                    ]
                ]
            ])
        ];
        
        file_get_contents($url . '?' . http_build_query($data));
    }
}
?>