Skip to content

Commit 07d87d7

Browse files
authored
Update bot.php
1 parent a8829bf commit 07d87d7

File tree

1 file changed

+84
-24
lines changed

1 file changed

+84
-24
lines changed

bot.php

Lines changed: 84 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,8 @@
11371137
$stmt = $connection->prepare("SELECT * FROM `server_info` WHERE `id`=?");
11381138
$stmt->bind_param("i", $server_id);
11391139
$stmt->execute();
1140-
$srv_remark = $stmt->get_result()->fetch_assoc()['remark'];
1140+
$serverInfo = $stmt->get_result()->fetch_assoc();
1141+
$srv_remark = $serverInfo['remark'];
11411142
$stmt->close();
11421143
$savedinfo = file_get_contents('settings/temp.txt');
11431144
$savedinfo = explode('-',$savedinfo);
@@ -1192,6 +1193,7 @@
11921193
}
11931194
if(!$response->success){
11941195
sendMessage('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
1196+
sendMessage("خطای سرور {$serverInfo['title']}:\n\n" . json_encode($response,488), null, null, $admin);
11951197
break;
11961198
}
11971199

@@ -1410,7 +1412,8 @@
14101412
$stmt = $connection->prepare("SELECT * FROM `server_info` WHERE `id`=?");
14111413
$stmt->bind_param("i", $server_id);
14121414
$stmt->execute();
1413-
$srv_remark = $stmt->get_result()->fetch_assoc()['remark'];
1415+
$serverInfo = $stmt->get_result()->fetch_assoc();
1416+
$srv_remark = $serverInfo['remark'];
14141417
$stmt->close();
14151418

14161419
$stmt = $connection->prepare("SELECT * FROM `server_config` WHERE `id`=?");
@@ -1456,15 +1459,16 @@
14561459
}
14571460

14581461
if(is_null($response)){
1459-
alert('❌ | 🥺 گلم ، اتصال به سرور برقرار نیست لطفا مدیر رو در جریان بزار ...');
1462+
sendMessage('❌ | 🥺 گلم ، اتصال به سرور برقرار نیست لطفا مدیر رو در جریان بزار ...');
14601463
exit;
14611464
}
14621465
if($response == "inbound not Found"){
1463-
alert("❌ | 🥺 سطر (inbound) با آیدی $inbound_id تو این سرور وجود نداره ، مدیر رو در جریان بزار ...");
1466+
sendMessage("❌ | 🥺 سطر (inbound) با آیدی $inbound_id تو این سرور وجود نداره ، مدیر رو در جریان بزار ...");
14641467
exit;
14651468
}
14661469
if(!$response->success){
1467-
alert('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
1470+
sendMessage('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
1471+
sendMessage("خطای سرور {$serverInfo['title']}:\n\n" . json_encode($response,488), null, null, $admin);
14681472
exit;
14691473
}
14701474

@@ -2496,7 +2500,8 @@
24962500
$stmt = $connection->prepare("SELECT * FROM `server_info` WHERE `id`=?");
24972501
$stmt->bind_param("i", $server_id);
24982502
$stmt->execute();
2499-
$srv_remark = $stmt->get_result()->fetch_assoc()['remark'];
2503+
$serverInfo = $stmt->get_result()->fetch_assoc();
2504+
$srv_remark = $serverInfo['remark'];
25002505
$stmt->close();
25012506

25022507
$stmt = $connection->prepare("SELECT * FROM `server_config` WHERE `id`=?");
@@ -2537,6 +2542,7 @@
25372542
}
25382543
if(!$response->success){
25392544
alert('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
2545+
sendMessage("خطای سرور {$serverInfo['title']}:\n\n" . json_encode($response,488), null, null, $admin);
25402546
exit;
25412547
}
25422548
alert('🚀 | 😍 در حال ارسال کانفیگ به مشتری ...');
@@ -2797,7 +2803,8 @@
27972803
$stmt = $connection->prepare("SELECT * FROM `server_info` WHERE `id`=?");
27982804
$stmt->bind_param("i", $server_id);
27992805
$stmt->execute();
2800-
$srv_remark = $stmt->get_result()->fetch_assoc()['remark'];
2806+
$serverInfo = $stmt->get_result()->fetch_assoc();
2807+
$srv_remark = $serverInfo['remark'];
28012808
$stmt->close();
28022809

28032810
$stmt = $connection->prepare("SELECT * FROM `server_config` WHERE `id`=?");
@@ -2838,6 +2845,7 @@
28382845
}
28392846
if(!$response->success){
28402847
alert('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
2848+
sendMessage("خطای سرور {$serverInfo['title']}:\n\n" . json_encode($response,488), null, null, $admin);
28412849
exit;
28422850
}
28432851
alert('🚀 | 😍 در حال ارسال کانفیگ به مشتری ...');
@@ -3042,7 +3050,8 @@
30423050
$stmt = $connection->prepare("SELECT * FROM `server_info` WHERE `id`=?");
30433051
$stmt->bind_param("i", $server_id);
30443052
$stmt->execute();
3045-
$srv_remark = $stmt->get_result()->fetch_assoc()['remark'];
3053+
$serverInfo = $stmt->get_result()->fetch_assoc();
3054+
$srv_remark = $serverInfo['remark'];
30463055
$stmt->close();
30473056

30483057
$stmt = $connection->prepare("SELECT * FROM `server_config` WHERE `id`=?");
@@ -3095,15 +3104,16 @@
30953104
}
30963105

30973106
if(is_null($response)){
3098-
alert('❌ | 🥺 گلم ، اتصال به سرور برقرار نیست لطفا مدیر رو در جریان بزار ...');
3107+
sendMessage('❌ | 🥺 گلم ، اتصال به سرور برقرار نیست لطفا مدیر رو در جریان بزار ...');
30993108
exit;
31003109
}
31013110
if($response == "inbound not Found"){
3102-
alert("❌ | 🥺 سطر (inbound) با آیدی $inbound_id تو این سرور وجود نداره ، مدیر رو در جریان بزار ...");
3111+
sendMessage("❌ | 🥺 سطر (inbound) با آیدی $inbound_id تو این سرور وجود نداره ، مدیر رو در جریان بزار ...");
31033112
exit;
31043113
}
31053114
if(!$response->success){
3106-
alert('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
3115+
sendMessage('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
3116+
sendMessage("خطای سرور {$serverInfo['title']}:\n\n" . json_encode($response,488), null, null, $admin);
31073117
exit;
31083118
}
31093119

@@ -3515,7 +3525,8 @@
35153525
$stmt = $connection->prepare("SELECT * FROM `server_info` WHERE `id`=?");
35163526
$stmt->bind_param("i", $server_id);
35173527
$stmt->execute();
3518-
$srv_remark = $stmt->get_result()->fetch_assoc()['remark'];
3528+
$serverInfo = $stmt->get_result()->fetch_assoc();
3529+
$srv_remark = $serverInfo['remark'];
35193530
$stmt->close();
35203531

35213532
$stmt = $connection->prepare("SELECT * FROM `server_config` WHERE `id`=?");
@@ -3562,15 +3573,16 @@
35623573
}
35633574
}
35643575
if(is_null($response)){
3565-
alert('❌ | 🥺 گلم ، اتصال به سرور برقرار نیست لطفا مدیر رو در جریان بزار ...');
3576+
sendMessage('❌ | 🥺 گلم ، اتصال به سرور برقرار نیست لطفا مدیر رو در جریان بزار ...');
35663577
exit;
35673578
}
35683579
if($response == "inbound not Found"){
3569-
alert("❌ | 🥺 سطر (inbound) با آیدی $inbound_id تو این سرور وجود نداره ، مدیر رو در جریان بزار ...");
3580+
sendMessage("❌ | 🥺 سطر (inbound) با آیدی $inbound_id تو این سرور وجود نداره ، مدیر رو در جریان بزار ...");
35703581
exit;
35713582
}
35723583
if(!$response->success){
3573-
alert('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
3584+
sendMessage('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
3585+
sendMessage("خطای سرور {$serverInfo['title']}:\n\n" . json_encode($response,488), null, null, $admin);
35743586
exit;
35753587
}
35763588

@@ -4859,7 +4871,8 @@
48594871
$stmt = $connection->prepare("SELECT * FROM `server_info` WHERE `id`=?");
48604872
$stmt->bind_param("i", $server_id);
48614873
$stmt->execute();
4862-
$srv_remark = $stmt->get_result()->fetch_assoc()['remark'];
4874+
$serverInfo = $stmt->get_result()->fetch_assoc();
4875+
$srv_remark = $serverInfo['remark'];
48634876
$stmt->close();
48644877

48654878
$stmt = $connection->prepare("SELECT * FROM `server_config` WHERE `id`=?");
@@ -4902,6 +4915,7 @@
49024915
}
49034916
if(!$response->success){
49044917
alert('❌ | 😮 وای خطا داد لطفا سریع به مدیر بگو ...');
4918+
sendMessage("خطای سرور {$serverInfo['title']}:\n\n" . json_encode($response,488), null, null, $admin);
49054919
exit;
49064920
}
49074921
alert('🚀 | 😍 در حال ارسال کانفیگ به مشتری ...');
@@ -6617,14 +6631,16 @@
66176631
$order = $stmt->get_result()->fetch_assoc();
66186632
$stmt->close();
66196633
$fid = $order['fileid'];
6634+
$agentBought = $order['agent_bought'];
6635+
$discountPercent = $userInfo['discount_percent'];
66206636

66216637
$stmt = $connection->prepare("SELECT * FROM `server_plans` WHERE `id` = ? AND `active` = 1");
66226638
$stmt->bind_param("i", $fid);
66236639
$stmt->execute();
66246640
$respd = $stmt->get_result()->fetch_assoc();
66256641
$stmt->close();
66266642
$price = $respd['price'];
6627-
6643+
if($agentBought == true) $price -= ($price * $discountPercent / 100);
66286644
if(!preg_match('/^discountRenew/', $userInfo['step'])){
66296645
$hash_id = RandomString();
66306646
$stmt = $connection->prepare("DELETE FROM `pays` WHERE `user_id` = ? AND `type` = 'RENEW_ACCOUNT' AND `state` = 'pending'");
@@ -6641,11 +6657,12 @@
66416657
$stmt->close();
66426658
}else $price = $afterDiscount;
66436659

6644-
6660+
if($price == 0) $price = "رایگان";
6661+
else $price .= " تومان";
66456662
$keyboard = array();
66466663
$temp = array();
66476664
if($botState['cartToCartState'] == "on"){
6648-
$temp[] = ['text' => "💳 کارت به کارت مبلغ $price تومان ", 'callback_data' => "payRenewWithCartToCart$hash_id"];
6665+
$temp[] = ['text' => "💳 کارت به کارت مبلغ $price", 'callback_data' => "payRenewWithCartToCart$hash_id"];
66496666
}
66506667
if($botState['nowPaymentOther'] == "on"){
66516668
$temp[] = ['text' => $buttonValues['now_payment_gateway'], 'url' => $botUrl . "pay/?nowpayment&hash_id=" . $hash_id];
@@ -6677,7 +6694,7 @@
66776694
$temp = array();
66786695
}
66796696
if($botState['walletState'] == "on"){
6680-
$temp[] = ['text' => "پرداخت با موجودی مبلغ $price تومان 💰", 'callback_data' => "payRenewWithWallet$hash_id"];
6697+
$temp[] = ['text' => "پرداخت با موجودی مبلغ $price", 'callback_data' => "payRenewWithWallet$hash_id"];
66816698
}
66826699
array_push($keyboard, $temp);
66836700
if(!preg_match('/^discountRenew/', $userInfo['step'])) $keyboard[] = [['text' => " 🎁 نکنه کد تخفیف داری؟ ", 'callback_data' => "haveDiscountRenew_" . $match[1] . "_" . $rowId]];
@@ -7275,6 +7292,14 @@
72757292
$stmt->execute();
72767293
$res = $stmt->get_result();
72777294
$stmt->close();
7295+
7296+
$stmt = $connection->prepare("SELECT * FROM `orders_list` WHERE `id` = ?");
7297+
$stmt->bind_param("i", $match[1]);
7298+
$stmt->execute();
7299+
$orderInfo = $stmt->get_result()->fetch_assoc();
7300+
$stmt->close();
7301+
$agentBought = $orderInfo['agent_bought'];
7302+
72787303
if($res->num_rows == 0){
72797304
alert("در حال حاضر هیچ پلنی برای افزایش مدت زمان سرویس وجود ندارد");
72807305
exit;
@@ -7284,7 +7309,10 @@
72847309
$id = $cat['id'];
72857310
$title = $cat['volume'];
72867311
$price = number_format($cat['price']);
7287-
$keyboard[] = ['text' => "$title روز $price تومان", 'callback_data' => "selectPlanDayIncrease{$match[1]}_$id"];
7312+
if($agentBought == true) $price -= ($price * $userInfo['discount_percent'] / 100);
7313+
if($price == 0) $price = "رایگان";
7314+
else $price .= " تومان";
7315+
$keyboard[] = ['text' => "$title روز $price", 'callback_data' => "selectPlanDayIncrease{$match[1]}_$id"];
72887316
}
72897317
$keyboard = array_chunk($keyboard,2);
72907318
$keyboard[] = [['text' => "صفحه اصلی 🏘", 'callback_data' => "mainMenu"]];
@@ -7302,6 +7330,14 @@
73027330
$stmt->close();
73037331
$planprice = $res['price'];
73047332

7333+
$stmt = $connection->prepare("SELECT * FROM `orders_list` WHERE `id` = ?");
7334+
$stmt->bind_param("i", $match['orderId']);
7335+
$stmt->execute();
7336+
$orderInfo = $stmt->get_result()->fetch_assoc();
7337+
$stmt->close();
7338+
$agentBought = $orderInfo['agent_bought'];
7339+
7340+
if($agentBought == true) $planprice -= ($planprice * $userInfo['discount_percent'] / 100);
73057341

73067342

73077343
$hash_id = RandomString();
@@ -7595,6 +7631,13 @@
75957631
$res = $stmt->get_result();
75967632
$stmt->close();
75977633

7634+
$stmt = $connection->prepare("SELECT * FROM `orders_list` WHERE `id` = ?");
7635+
$stmt->bind_param("i", $match[1]);
7636+
$stmt->execute();
7637+
$orderInfo = $stmt->get_result()->fetch_assoc();
7638+
$stmt->close();
7639+
$agentBought = $orderInfo['agent_bought'];
7640+
75987641
if($res->num_rows==0){
75997642
alert("در حال حاضر هیچ پلن حجمی وجود ندارد");
76007643
exit;
@@ -7604,7 +7647,11 @@
76047647
$id = $cat['id'];
76057648
$title = $cat['volume'];
76067649
$price = number_format($cat['price']);
7607-
$keyboard[] = ['text' => "$title گیگ $price تومان", 'callback_data' => "increaseVolumePlan{$match[1]}_{$id}"];
7650+
if($agentBought == true) $price -= ($price * $userInfo['discount_percent'] /100);
7651+
if($price == 0) $price = "رایگان";
7652+
else $price .= ' تومان';
7653+
7654+
$keyboard[] = ['text' => "$title گیگ $price", 'callback_data' => "increaseVolumePlan{$match[1]}_{$id}"];
76087655
}
76097656
$keyboard = array_chunk($keyboard,2);
76107657
$keyboard[] = [['text'=>"صفحه ی اصلی 🏘",'callback_data'=>"mainMenu"]];
@@ -7622,6 +7669,14 @@
76227669
$planprice = $res['price'];
76237670
$plangb = $res['volume'];
76247671

7672+
$stmt = $connection->prepare("SELECT * FROM `orders_list` WHERE `id` = ?");
7673+
$stmt->bind_param("i", $match['orderId']);
7674+
$stmt->execute();
7675+
$orderInfo = $stmt->get_result()->fetch_assoc();
7676+
$stmt->close();
7677+
$agentBought = $orderInfo['agent_bought'];
7678+
7679+
if($agentBought == true) $planprice -= ($planprice * $userInfo['discount_percent'] /100);
76257680

76267681
$hash_id = RandomString();
76277682
$stmt = $connection->prepare("DELETE FROM `pays` WHERE `user_id` = ? AND `type` LIKE '%INCREASE_VOLUME%' AND `state` = 'pending'");
@@ -7639,8 +7694,13 @@
76397694

76407695
$keyboard = array();
76417696
$temp = array();
7697+
7698+
if($planprice == 0) $planprice = ' رایگان';
7699+
else $planprice = " " . number_format($planprice) . " تومان";
7700+
7701+
76427702
if($botState['cartToCartState'] == "on"){
7643-
$temp[] = ['text' => $buttonValues['cart_to_cart'] . number_format($planprice) . " تومان", 'callback_data' => "payIncreaseWithCartToCart$hash_id"];
7703+
$temp[] = ['text' => $buttonValues['cart_to_cart'] . $planprice, 'callback_data' => "payIncreaseWithCartToCart$hash_id"];
76447704
}
76457705
if($botState['nowPaymentOther'] == "on"){
76467706
$temp[] = ['text' => $buttonValues['now_payment_gateway'], 'url' => $botUrl . "pay/?nowpayment&hash_id=" . $hash_id];
@@ -7671,7 +7731,7 @@
76717731
$temp = array();
76727732
}
76737733
if($botState['walletState'] == "on"){
7674-
$temp[] = ['text' => "💰پرداخت با موجودی " . number_format($planprice) . " تومان", 'callback_data' => "payIncraseWithWallet$hash_id"];
7734+
$temp[] = ['text' => "💰پرداخت با موجودی " . $planprice, 'callback_data' => "payIncraseWithWallet$hash_id"];
76757735
}
76767736
array_push($keyboard, $temp);
76777737
$keyboard[] = [['text'=>$buttonValues['cancel'], 'callback_data'=> "mainMenu"]];

0 commit comments

Comments
 (0)