File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments