Update: 2026-06-24 22:56:39

This commit is contained in:
Hamza-Ayed
2026-06-24 22:56:39 +03:00
parent f75e456aac
commit 12dfb25629
2 changed files with 15 additions and 21 deletions

View File

@@ -131,30 +131,15 @@ function sendNabehOtp(string $receiver, string $otp, string $method = '', string
// Strip symbols for Nabeh endpoint
$phoneRaw = preg_replace('/\D+/', '', $receiver);
// Map method/type
$type = 'text';
if ($method === 'voice') {
$type = 'voice';
// Map method/type (Image OTP is the default and only media method allowed)
$type = 'image';
if ($method === 'text') {
$type = 'text';
} elseif ($method === 'image') {
$type = 'image';
} elseif ($method === 'text') {
$type = 'text';
} else {
// Strict alternating using Redis
global $redis;
$type = 'image'; // default
if ($redis) {
try {
$lastType = $redis->get('nabeh_last_type');
$type = ($lastType === 'image') ? 'voice' : 'image';
$redis->set('nabeh_last_type', $type);
} catch (Exception $e) {
error_log("⚠️ [Nabeh OTP Redis alternate] Error toggling type: " . $e->getMessage());
}
} else {
// Fallback to random if Redis is not connected
$type = (random_int(0, 1) === 0) ? 'image' : 'voice';
}
// If no method specified or if 'voice' was requested, force default to 'image'
$type = 'image';
}
$appName = 'سيرو رايدر';