logged_in == 1) { $loading = sendMessage($from_id, "⏳ *در حال بارگذاری کیف پول...*"); $msgId = $loading->result->message_id ?? null; $loginUsername = $user->login_username; if (!$loginUsername) { if ($msgId) deleteMessage($from_id, $msgId); sendMessage($from_id, "⚠️ خطا: هیچ حسابی وارد نشده است. لطفاً دوباره وارد شوید.", $backToMainKeyboard); die; } $stmtAcc = $pdo->prepare("SELECT `balance` FROM `accounts` WHERE `username` = ? LIMIT 1"); $stmtAcc->execute([$loginUsername]); $acc = $stmtAcc->fetch(); if (!$acc) { if ($msgId) deleteMessage($from_id, $msgId); sendMessage($from_id, "❌ خطا: حساب شما پیدا نشد. لطفاً دوباره وارد شوید.", $backToMainKeyboard); die; } $balanceIrt = (int) $acc->balance; $balanceIrtFormatted = number_format($balanceIrt); $rawPrice = getUsdtIrtPrice(); $profitPercent = getSetting("profit_percent"); if ($rawPrice && is_numeric($rawPrice)) { $usdtPrice = $rawPrice + ($rawPrice * ($profitPercent / 100)); } else { $usdtPrice = false; } if ($usdtPrice !== false) { $balanceUsdt = $balanceIrt / $usdtPrice; $balanceUsdtFormatted = number_format($balanceUsdt, 3) . " USDT"; } else { $balanceUsdtFormatted = "❌ خطای دریافت قیمت از وبسرویس"; } if ($msgId) deleteMessage($from_id, $msgId); $responseText = "👝 *کیف پول شما* 💰 *موجودی (تومان):* `{$balanceIrtFormatted}` تومان 🪙 *موجودی (تتر):* `{$balanceUsdtFormatted}` از دکمه‌های زیر می‌تونی مدیریت کیف پول رو انجام بدی:"; sendMessage($from_id, $responseText, $walletKeyboard); die; }