Skip to content

Commit 855fcfd

Browse files
committed
Added daily income notification
1 parent 7b6f010 commit 855fcfd

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

rewardReport.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
include_once 'baseInfo.php';
3+
include_once 'config.php';
4+
5+
if(file_exists("botState.json")){
6+
$botState = json_decode(file_get_contents("botState.json"),true);
7+
$sellState=$botState['sellState']=="off"?"خاموش ❌":"روشن ✅";
8+
$searchState=$botState['searchState']=="off"?"خاموش ❌":"روشن ✅";
9+
$rewaredTime = ($botState['rewaredTime']??0);
10+
$rewaredChannel = $botState['rewardChannel'];
11+
12+
if($rewaredTime>0 && $rewaredChannel != null){
13+
$lastTime = $botState['lastRewardMessage']??0;
14+
if(time() > $lastTime){
15+
$time = time() - ($rewaredTime * 60 * 60);
16+
$stmt = $connection->prepare("SELECT SUM(amount) as total FROM `orders_list` WHERE `date` > ?");
17+
$stmt->bind_param("i", $time);
18+
$stmt->execute();
19+
$totalRewards = number_format($stmt->get_result()->fetch_assoc()['total']) . " تومان";
20+
$stmt->close();
21+
$botState['lastRewardMessage']=time() + ($rewaredTime * 60 * 60);
22+
file_put_contents("botState.json",json_encode($botState));
23+
$txt = "   
24+
🔰درآمد من در $rewaredTime ساعت گذشته
25+
26+
💰مبلغ : $totalRewards تومان
27+
28+
☑️ $channelLock
29+
30+
";
31+
sendMessage($txt, null, null, $rewaredChannel);
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)