is_admin) { $bot->sendMessage($from_id, '🔧 لطفا بخشی که قیمت آن را میخواهید تغییر دهید انتخاب کنید:', $change_price_keyboard); die; } if ($text == '💵 قیمت فروش یو ووچر' && $currentUser->is_admin) { $usdt_irt_price = getUsdtIrtPrice(); if ($usdt_irt_price === null || $usdt_irt_price === false || !is_numeric($usdt_irt_price)) { $bot->sendMessage($from_id, "⚠️ خطا در دریافت قیمت لحظه‌ای تتر از وب‌سرویس. لطفا بعداً دوباره تلاش کنید."); die; } $uv_buy = getSettingsBot('uv_buy')->value_ ?? 0; $final_price = (int)$usdt_irt_price + (int)$uv_buy; $message = "📉 لطفا مبلغ سود (افزایش قیمت) مورد نظر خود را که می‌خواهید به قیمت تتر اضافه شود، وارد کنید:\n\n"; $message .= "💰 قیمت تتر لحظه‌ای: " . number_format($usdt_irt_price) . " تومان\n"; $message .= "💵 قیمت فعلی فروش یو ووچر: " . number_format($final_price) . " تومان"; $bot->sendMessage($from_id, $message, $back_to_admin); setStep($from_id, 'set-uv-buy'); die; } if ($currentUser->step == 'set-uv-buy' && $currentUser->is_admin) { if (is_numeric($text)) { $key = 'uv_buy'; $value = $text; $query = "SELECT * FROM `settings` WHERE `key_` = ?"; $stmt = $db->prepare($query); $stmt->execute([$key]); $existingRecord = $stmt->fetch(); if (!$existingRecord) { $insertQuery = "INSERT INTO `settings` (`key_`, `value_`) VALUES (?, ?)"; $insertStmt = $db->prepare($insertQuery); $insertStmt->execute([$key, $value]); } else { changeSettings($key, $value); } $bot->sendMessage($from_id, "✅ مقدار روی $value تومان تنظیم گردید.", $change_price_keyboard); setStep($from_id, 'home'); } else { $bot->sendMessage($from_id, "❌ لطفا یک مقدار عددی معتبر وارد کنید.", $change_price_keyboard); } die; } if ($text == '🛒 قیمت خرید یو ووچر' && $currentUser->is_admin) { $usdt_irt_price = getUsdtIrtPrice(); if ($usdt_irt_price === null) { $bot->sendMessage($from_id, "⚠️ خطا در دریافت قیمت لحظه‌ای تتر. لطفا بعدا تلاش کنید."); die; } $uv_sell = getSettingsBot('uv_sell')->value_ ?? 0; $final_price = (int)$usdt_irt_price + (int)$uv_sell; $message = "📈 قیمت لحظه‌ای تتر: " . number_format($usdt_irt_price) . " تومان\n"; $message .= "💰 قیمت فعلی خرید یو ووچر از کاربر: " . number_format($final_price) . " تومان\n\n"; $message .= "📢 لطفا مبلغی که می‌خواهید هنگام خرید یو ووچر از کاربر به قیمت تتر اضافه یا از آن کسر شود، وارد کنید:"; $bot->sendMessage($from_id, $message, $back_to_admin); setStep($from_id, 'set-uv-sell'); die; } if ($currentUser->step == 'set-uv-sell' && $currentUser->is_admin) { if (is_numeric($text)) { $key = 'uv_sell'; $value = $text; $query = "SELECT * FROM `settings` WHERE `key_` = ?"; $stmt = $db->prepare($query); $stmt->execute([$key]); $existingRecord = $stmt->fetch(); if (!$existingRecord) { $insertQuery = "INSERT INTO `settings` (`key_`, `value_`) VALUES (?, ?)"; $insertStmt = $db->prepare($insertQuery); $insertStmt->execute([$key, $value]); } else { changeSettings($key, $value); } $bot->sendMessage($from_id, "✅ مقدار روی $value تومان تنظیم گردید.", $change_price_keyboard); setStep($from_id, 'home'); } else { $bot->sendMessage($from_id, "❌ لطفا یک مقدار عددی معتبر وارد کنید.", $change_price_keyboard); } die; } if ($text == '💎 قیمت فروش پرمیوم' && $currentUser->is_admin) { $currentPrice = getSettingsBot('ps_buy')->value_ ?? 0; $bot->sendMessage($from_id, "📉 لطفا قیمت جدید فروش پرمیوم به کاربر را وارد کنید:\n\n💰 قیمت فعلی: $currentPrice تومان", $back_to_admin); setStep($from_id, 'set-ps-buy'); die; } if ($currentUser->step == 'set-ps-buy' && $currentUser->is_admin) { if (is_numeric($text)) { $key = 'ps_buy'; $value = $text; $query = "SELECT * FROM `settings` WHERE `key_` = ?"; $stmt = $db->prepare($query); $stmt->execute([$key]); $existingRecord = $stmt->fetch(); if (!$existingRecord) { $insertQuery = "INSERT INTO `settings` (`key_`, `value_`) VALUES (?, ?)"; $insertStmt = $db->prepare($insertQuery); $insertStmt->execute([$key, $value]); } else { changeSettings($key, $value); } $bot->sendMessage($from_id, "✅ مقدار روی $value تومان تنظیم گردید.", $change_price_keyboard); setStep($from_id, 'home'); } else { $bot->sendMessage($from_id, "❌ لطفا یک مقدار عددی معتبر وارد کنید.", $change_price_keyboard); } die; } if ($text == '🔑 قیمت خرید پرمیوم' && $currentUser->is_admin) { $currentPrice = getSettingsBot('ps_sell')->value_ ?? 0; $bot->sendMessage($from_id, "📈 لطفا قیمت جدید خرید پرمیوم از کاربر را وارد کنید:\n\n💰 قیمت فعلی: $currentPrice تومان", $back_to_admin); setStep($from_id, 'set-ps-sell'); die; } if ($currentUser->step == 'set-ps-sell' && $currentUser->is_admin) { if (is_numeric($text)) { $key = 'ps_sell'; $value = $text; $query = "SELECT * FROM `settings` WHERE `key_` = ?"; $stmt = $db->prepare($query); $stmt->execute([$key]); $existingRecord = $stmt->fetch(); if (!$existingRecord) { $insertQuery = "INSERT INTO `settings` (`key_`, `value_`) VALUES (?, ?)"; $insertStmt = $db->prepare($insertQuery); $insertStmt->execute([$key, $value]); } else { changeSettings($key, $value); } $bot->sendMessage($from_id, "✅ مقدار روی $value تومان تنظیم گردید.", $change_price_keyboard); setStep($from_id, 'home'); } else { $bot->sendMessage($from_id, "❌ لطفا یک مقدار عددی معتبر وارد کنید.", $change_price_keyboard); } die; } if ($text == '🎁 درصد کمیسیون زیرمجموعه' && $currentUser->is_admin) { $currentPrice = getSettingsBot('bonus_percent')->value_ ?? 0; $bot->sendMessage($from_id, "📈 لطفا درصد هدیه زیرمجموعه گیری کاربران را وارد کنید:\n\n💰 درصد فعلی: $currentPrice درصد", $back_to_admin); setStep($from_id, 'set-bonus-percent'); die; } if ($currentUser->step == 'set-bonus-percent' && $currentUser->is_admin) { if (is_numeric($text)) { $key = 'bonus_percent'; $value = $text; $query = "SELECT * FROM `settings` WHERE `key_` = ?"; $stmt = $db->prepare($query); $stmt->execute([$key]); $existingRecord = $stmt->fetch(); if (!$existingRecord) { $insertQuery = "INSERT INTO `settings` (`key_`, `value_`) VALUES (?, ?)"; $insertStmt = $db->prepare($insertQuery); $insertStmt->execute([$key, $value]); } else { changeSettings($key, $value); } $bot->sendMessage($from_id, "✅ مقدار روی $value درصد تنظیم گردید.", $change_price_keyboard); setStep($from_id, 'home'); } else { $bot->sendMessage($from_id, "❌ لطفا یک مقدار عددی معتبر وارد کنید.", $change_price_keyboard); } die; } if ($text == '📤 انتشار قیمت در کانال') { $channel = getSettingsBot('main_channel')->value_; if (!$channel) { $bot->sendMessage($from_id, '❗️ لطفا ابتدا شناسه کانال را ثبت کنید.'); die; } $usdt_irt_price = getUsdtIrtPrice(); if ($usdt_irt_price === null || $usdt_irt_price === false) { $bot->sendMessage($from_id, "⚠️ خطا در دریافت قیمت لحظه‌ای تتر\nلطفاً بعداً دوباره تلاش کنید."); die; } $uv_buy_raw = getSettingsBot('uv_buy')->value_ ?? 0; $uv_sell_raw = getSettingsBot('uv_sell')->value_ ?? 0; $final_buy = (int)$usdt_irt_price + (int)$uv_buy_raw; $final_sell = (int)$usdt_irt_price + (int)$uv_sell_raw; $prices = [ 'uv_buy' => number_format($final_buy), 'uv_sell' => number_format($final_sell), ]; $current_time = jdate("Y/m/d - H:i:s", strtotime(date("Y/m/d H:i:s")), tr_num: 'en'); $usdt_price_formatted = number_format($usdt_irt_price); $response_text = "💎 *قیمت‌های لحظه‌ای ووچر*\n\n"; $response_text .= "━━━━━━━━━━━━━━━━━━━━\n\n"; $response_text .= "💵 *قیمت پایه تتر (USDT)*:\n"; $response_text .= "`$usdt_price_formatted` تومان\n\n"; $response_text .= "🛒 *یو ووچر (UUSD)*:\n"; $response_text .= "💰 *قیمت خرید از ما*: `{$prices['uv_buy']}` تومان\n"; $response_text .= "💵 *قیمت فروش به ما*: `{$prices['uv_sell']}` تومان\n\n"; $response_text .= "━━━━━━━━━━━━━━━━━━━━\n\n"; $response_text .= "📊 *توضیحات:*\n"; $response_text .= "• تمامی قیمت‌ها به‌صورت لحظه‌ای و به‌روز می‌باشند\n"; $response_text .= "• قیمت‌ها بر اساس نرخ بازار محاسبه می‌شوند\n"; $response_text .= "• امکان تغییر قیمت در هر لحظه وجود دارد\n\n"; $response_text .= "🕐 *زمان بروزرسانی:*\n"; $response_text .= "`$current_time`"; $bot->sendMessage($channel, $response_text, json_encode([ 'inline_keyboard' => [ [['text' => '🤖 ورود به ربات', 'url' => 'https://t.me/FastexIR_bot']] ] ])); $bot->sendMessage($from_id, '✅ قیمت‌ها با موفقیت به کانال اصلی ارسال شدند.'); die; }