1 | <?php |
||||
2 | declare(strict_types=1); |
||||
3 | |||||
4 | use AnarchyService\Get; |
||||
5 | use AnarchyService\Base; |
||||
6 | use AnarchyService\DB\DB; |
||||
7 | use AnarchyService\SendRequest\Chat; |
||||
8 | use AnarchyService\SendRequest\Edit; |
||||
9 | use AnarchyService\SendRequest\Send; |
||||
10 | use AnarchyService\Clsses\GoogleTranslate; |
||||
11 | |||||
12 | require_once 'vendor/autoload.php'; |
||||
13 | |||||
14 | $tg = new Base(); |
||||
15 | $DB = DB::Database(); |
||||
16 | if ($argv[1]) { |
||||
17 | $argument = trim($argv[1]); |
||||
18 | if ($argument != '') { |
||||
19 | Get::set(json_decode(file_get_contents($argument))); |
||||
20 | unlink($argument); |
||||
21 | } |
||||
22 | } else { |
||||
23 | Get::set($tg->getWebhookUpdates()); |
||||
24 | } |
||||
25 | $sudors = explode(',', getenv('ADMINS')); |
||||
26 | $Group = $DB->SelectData('Groups/' . Get::$chat_id, Get::$chat_id, ['Chat_id' => Get::$chat_id]); |
||||
27 | if (!$Group) { |
||||
28 | $Administrators = Chat::getChatAdministrators(Get::$chat_id)->result; |
||||
29 | $Admins = [Get::$from_id]; |
||||
30 | foreach ($Administrators as $administrator) { |
||||
31 | if ($administrator->status == 'administrator') { |
||||
32 | $Admins[] = $administrator->user->id; |
||||
33 | } elseif ($administrator->status == 'creator') { |
||||
34 | $Creator = $administrator->user->id; |
||||
35 | } |
||||
36 | } |
||||
37 | $DefaultSettings = [ |
||||
38 | 'WelcomeMSGStatus' => |
||||
39 | [ |
||||
40 | 'Value' => true, |
||||
41 | 'name' => 'وضعیت ارسال پیام خوش آمدگویی' |
||||
42 | ], |
||||
43 | 'InfoMSGStatus' => |
||||
44 | [ |
||||
45 | 'Value' => true, |
||||
46 | 'name' => 'وضعیت ارسال پیام اینفو' |
||||
47 | ], |
||||
48 | 'ForceTOChannelJoin' => |
||||
49 | [ |
||||
50 | 'Value' => true, |
||||
51 | 'name' => 'وضعیت عضویت اجباری در کانال' |
||||
52 | ], |
||||
53 | 'ForceTOAddInGP' => |
||||
54 | [ |
||||
55 | 'Value' => false, |
||||
56 | 'name' => 'وضعیت اد اجباری در گروه' |
||||
57 | ], |
||||
58 | 'CaptchaStatus' => |
||||
59 | [ |
||||
60 | 'Value' => true, |
||||
61 | 'name' => 'وضعیت تایید اجباری کپچا' |
||||
62 | ], |
||||
63 | 'ConversationStatus' => |
||||
64 | [ |
||||
65 | 'Value' => false, |
||||
66 | 'name' => 'وضعیت پاسخ دادن ربات' |
||||
67 | ], |
||||
68 | 'SpamReportStatus' => |
||||
69 | [ |
||||
70 | 'Value' => true, |
||||
71 | 'name' => 'وضعیت ارسال گزارش اسپم' |
||||
72 | ], |
||||
73 | 'WarnInSpam' => |
||||
74 | [ |
||||
75 | 'Value' => true, |
||||
76 | 'name' => 'وضعیت اخطار دادن هنگام اسپم' |
||||
77 | ], |
||||
78 | 'DelTGServicesStatus' => |
||||
79 | [ |
||||
80 | 'Value' => false, |
||||
81 | 'name' => 'وضعیت حذف پیام های سرویس تلگرام' |
||||
82 | ], |
||||
83 | 'DelLinkStatus' => |
||||
84 | [ |
||||
85 | 'Value' => false, |
||||
86 | 'name' => 'وضعیت حذف لینک' |
||||
87 | ], |
||||
88 | 'DelTGLinkStatus' => |
||||
89 | [ |
||||
90 | 'Value' => false, |
||||
91 | 'name' => 'وضعیت حذف لینک تلگرامی' |
||||
92 | ], |
||||
93 | 'DelMentionStatus' => |
||||
94 | [ |
||||
95 | 'Value' => false, |
||||
96 | 'name' => 'وضعیت حذف منشن' |
||||
97 | ], |
||||
98 | 'DelForwardStatus' => |
||||
99 | [ |
||||
100 | 'Value' => false, |
||||
101 | 'name' => 'وضعیت حذف فوروارد' |
||||
102 | ], |
||||
103 | 'DelFilterWordsStatus' => |
||||
104 | [ |
||||
105 | 'Value' => false, |
||||
106 | 'name' => 'وضعیت حذف کلمات فیلتر شده' |
||||
107 | ], |
||||
108 | 'RemDelAccountStatus' => |
||||
109 | [ |
||||
110 | 'Value' => false, |
||||
111 | 'name' => 'وضعیت حذف دیلیت اکانت (خودکار بصورت هفتگی)' |
||||
112 | ], |
||||
113 | 'RemBotsStatus' => |
||||
114 | [ |
||||
115 | 'Value' => false, |
||||
116 | 'name' => 'وضعیت حذف ربات (خودکار بصورت هفتگی)' |
||||
117 | ], |
||||
118 | 'RemTabChiStatus' => |
||||
119 | [ |
||||
120 | 'Value' => false, |
||||
121 | 'name' => 'وضعیت حذف تبچی (خودکار بصورت هفتگی)' |
||||
122 | ] |
||||
123 | ]; |
||||
124 | $DB->CreateTable('Groups/' . Get::$chat_id, Get::$chat_id, [ |
||||
125 | 'Working' => true, |
||||
126 | 'AddAt' => time(), |
||||
127 | 'Chat_id' => Get::$chat_id, |
||||
128 | 'Chat_title' => Get::$chat_title, |
||||
129 | 'ChargeEnd' => 0, |
||||
130 | 'BotAdder' => Get::$from_id, |
||||
131 | 'Creator' => $Creator, |
||||
132 | 'Administrators' => $Admins, |
||||
133 | 'WhiteListUsers' => [], |
||||
134 | 'WhiteListChannels' => [], |
||||
135 | 'WordsFilterList' => [], |
||||
136 | 'MSGs' => [ |
||||
137 | 'WelcomeMSG' => ['MSG'=>' سلام -MENTION=~NEW_USER_ID~~NEW_FIRST_NAME~- ~ENTER~ به گروه ~GROUP_TITLE~ خوش آمدید. ','name'=>'پیام خوش آمدگویی'], |
||||
138 | 'ForceADDMSG' => ['MSG'=>' سلام -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ برای ارسال پیام ابتدا ~SHOULD_ADD_NUMBER~ نفر اد کنید. ~ENTER~ تعداد اد شده توسط شما : ~ADD_NUMBER~','name'=>'پیام اد اجباری'], |
||||
139 | 'ForceChannelJoinMSG' => ['MSG'=>' سلام -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ برای ارسال پیام ابتدا عضو کانال های زیر شوید. ','name'=>'پیام عضویت اجباری'], |
||||
140 | 'CaptchaMSG' => ['MSG'=>' سلام -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ برای ارسال پیام ابتدا حساب کاربری خود را تایید کنید. ~ENTER~ 3/~CAPTCHASENDNUM~ ','name'=>'پیام کپچا'], |
||||
141 | 'SpamReportMSG' => ['MSG'=>' کاربر -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ تو گروه اسپم میکنه. ~ENTER~ -MENTION=~CREATOR_ID~ADMIN- ','name'=>'پیام گزارش اسپم'], |
||||
142 | 'WarnMSG' => ['MSG'=>' کاربر -MENTION=~IN_REPLY_ID~~IN_REPLY_FIRST_NAME~- ~ENTER~ یک اخطار به اخطار های شما اضافه شد ~ENTER~ ~USERWARNCOUNT~/~WARNNUMBERTOREMOVE~ ','name'=>'پیام اخطار'], |
||||
143 | 'delWarnMSG' => ['MSG'=>' کاربر -MENTION=~IN_REPLY_ID~~IN_REPLY_FIRST_NAME~- ~ENTER~ یک اخطار از اخطار های شما کسر شد ~ENTER~ ~USERWARNCOUNT~/~WARNNUMBERTOREMOVE~ ','name'=>'پیام حذف اخطار'], |
||||
144 | 'BotWarnMSG' => ['MSG'=>' کاربر -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ یک اخطار به اخطار های شما اضافه شد ~ENTER~ ~USERWARNCOUNT~/~WARNNUMBERTOREMOVE~ ','name'=>'پیام اخطار اسپم'], |
||||
145 | ], |
||||
146 | 'DelWlcMSGAfter' => 5, |
||||
147 | 'DelForceAddMSGAfter' => 5, |
||||
148 | 'DelForceJoinMSGAfter' => 5, |
||||
149 | 'DelCaptchaMSGAfter' => 5, |
||||
150 | 'DelWarnMSGAfter' => 5, |
||||
151 | 'DelReportMSGAfter' => 5, |
||||
152 | 'SpamNumberToReport' => 5, |
||||
153 | 'SpamTimeToReport' => 5, |
||||
154 | 'WarnNumberToRemove' => 5, |
||||
155 | 'AddNumber' => 5, |
||||
156 | 'GPWarns' => 0, |
||||
157 | 'GPChannels' => [], |
||||
158 | 'PreviousMembersShouldJoin' => false, |
||||
159 | 'PreviousMembersShouldAdd' => false, |
||||
160 | 'PreviousMembersShouldVerifyCaptcha' => false, |
||||
161 | 'Settings' => $DefaultSettings |
||||
162 | ]); |
||||
163 | $msg = 'سلام' . PHP_EOL . 'برای فعال سازی رایگان ربات، من رو به عنوان ادمین گروه انتخاب کنید' . PHP_EOL . 'با فرستادن راهنما هم میتوانید آموزش استفاده از ربات را یاد بگیرید 😃'; |
||||
164 | Send::sendMessage(Get::$chat_id, $msg); |
||||
165 | $Group = $DB->SelectData('Groups/' . Get::$chat_id, Get::$chat_id, ['Chat_id' => Get::$chat_id]); |
||||
166 | } |
||||
167 | if ($Group->Working) { |
||||
168 | $user_id = Get::$new_chat_member_id ?? Get::$from_id; |
||||
169 | $IsClintBot = $DB->SelectData('Users/BlackDir', 'ClintBotList', ['User_id' => $user_id]); |
||||
170 | $InBlackList = $DB->SelectData('Users/BlackDir', 'BlackList', ['User_id' => $user_id]); |
||||
171 | $User = $DB->SelectData('Users', $user_id, ['User_id' => $user_id]); |
||||
172 | if ($IsClintBot || $InBlackList) { |
||||
173 | Chat::kickChatMember(Get::$chat_id, $user_id); |
||||
174 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
175 | die(); |
||||
176 | } elseif (!$User) { |
||||
177 | $DB->CreateTable('Users', $user_id, [ |
||||
178 | 'User_id' => $user_id, |
||||
179 | 'MSGCount' => 0, |
||||
180 | 'LTU' => 0, # Last Thank UnixTime |
||||
181 | 'ThankCount' => 0, |
||||
182 | 'CaptchaStatus' => false, |
||||
183 | 'CaptchaSendNum' => 0, |
||||
184 | ]); |
||||
185 | $User = $DB->SelectData('Users', $user_id, ['User_id' => $user_id]); |
||||
186 | } |
||||
187 | $Member = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', $user_id, ['User_id' => $user_id]); |
||||
188 | if (!$Member) { |
||||
189 | if (Get::$from_id != $user_id) { |
||||
190 | $adder = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', Get::$from_id, ['User_id' => Get::$from_id]); |
||||
191 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', Get::$from_id, ['AddNumber' => ++$adder->AddNumber], ['User_id' => Get::$from_id]); |
||||
192 | } |
||||
193 | $DB->CreateTable('Groups/' . Get::$chat_id . '/Users', $user_id, [ |
||||
194 | 'User_id' => $user_id, |
||||
195 | 'SSCU' => time(), # Start Spam Count UnixTime |
||||
196 | 'SpamCount' => 0, |
||||
197 | 'WarnCount' => 0, |
||||
198 | 'AddNumber' => 0, |
||||
199 | 'SendReportAt' => 0, |
||||
200 | 'AddDone' => !$Group->PreviousMembersShouldAdd && !Get::$new_chat_member_id, |
||||
201 | 'AddedBy' => (Get::$from_id != $user_id) ? Get::$from_id : 0, |
||||
202 | ]); |
||||
203 | $Member = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', $user_id, ['User_id' => $user_id]); |
||||
204 | } |
||||
205 | if (!in_array($user_id, $sudors) && $user_id != $Group->Creator && !in_array($user_id, $Group->Administrators) && !in_array($user_id, $Group->WhiteListUsers)) { |
||||
206 | foreach($Group->MSGs as $key => $value){ |
||||
207 | $text = $value->MSG; |
||||
208 | if (strpos($text, '-MENTION')) $text = preg_replace('/-MENTION=(~.*?~)(.*?)-/',"<a href='tg://user?id=$1'>$2</a>",$text); |
||||
209 | if (strpos($text, '~USER_ID~')) $text = str_replace('~USER_ID~', Get::$from_id, $text); |
||||
210 | if (strpos($text, '~FIRST_NAME~')) $text = str_replace('~FIRST_NAME~', Get::$from_first_name, $text); |
||||
211 | if (strpos($text, '~LAST_NAME~')) $text = str_replace('~LAST_NAME~', Get::$from_last_name, $text); |
||||
212 | if (strpos($text, '~USERNAME~')) $text = str_replace('~USERNAME~', Get::$from_username, $text); |
||||
213 | // |
||||
214 | if (strpos($text, '~GROUP_ID~')) $text = str_replace('~GROUP_ID~', '@' . Get::$chat_id, $text); |
||||
215 | if (strpos($text, '~GROUP_TITLE~')) $text = str_replace('~GROUP_TITLE~', Get::$chat_title, $text); |
||||
216 | if (strpos($text, '~GROUP_USERNAME~')) $text = str_replace('~GROUP_USERNAME~', '@' . Get::$chat_username, $text); |
||||
217 | // |
||||
218 | if (strpos($text, '~NEW_USER_ID~')) $text = str_replace('~NEW_USER_ID~', Get::$new_chat_member_id, $text); |
||||
219 | if (strpos($text, '~NEW_FIRST_NAME~')) $text = str_replace('~NEW_FIRST_NAME~', Get::$new_chat_member_first_name, $text); |
||||
220 | if (strpos($text, '~NEW_LAST_NAME~')) $text = str_replace('~NEW_LAST_NAME~', Get::$new_chat_member_last_name, $text); |
||||
221 | if (strpos($text, '~NEW_USERNAME~')) $text = str_replace('~NEW_USERNAME~', Get::$new_chat_member_username, $text); |
||||
222 | // |
||||
223 | if (strpos($text, '~IN_REPLY_ID~')) $text = str_replace('~IN_REPLY_ID~', Get::$reply_to_from_id, $text); |
||||
224 | if (strpos($text, '~IN_REPLY_FIRST_NAME~')) $text = str_replace('~IN_REPLY_FIRST_NAME~', Get::$reply_to_from_first_name, $text); |
||||
225 | if (strpos($text, '~IN_REPLY_LAST_NAME~')) $text = str_replace('~IN_REPLY_LAST_NAME~', Get::$reply_to_from_last_name, $text); |
||||
226 | if (strpos($text, '~IN_REPLY_USERNAME~')) $text = str_replace('~IN_REPLY_USERNAME~', Get::$reply_to_from_username, $text); |
||||
227 | // |
||||
228 | if (strpos($text, '~ENTER~')) $text = str_replace('~ENTER~', "\n", $text); |
||||
229 | if (strpos($text, '~CREATOR_ID~')) $text = str_replace('~CREATOR_ID~', $Group->Creator, $text); |
||||
230 | if (strpos($text, '~GP_CHANNEL~')) $text = str_replace('~GP_CHANNEL~', $Group->Creator, $text); |
||||
231 | if (strpos($text, '~CAPTCHASENDNUM~')) $text = str_replace('~CAPTCHASENDNUM~', $User->CaptchaSendNum, $text); |
||||
232 | if (strpos($text, '~USERWARNCOUNT~')) $text = str_replace('~USERWARNCOUNT~', $Member->WarnCount, $text); |
||||
233 | if (strpos($text, '~WARNNUMBERTOREMOVE~')) $text = str_replace('~WARNNUMBERTOREMOVE~', $Group->WarnNumberToRemove, $text); |
||||
234 | if (strpos($text, '~ADD_NUMBER~')) $text = str_replace('~ADD_NUMBER~', $Member->AddNumber, $text); |
||||
235 | if (strpos($text, '~SHOULD_ADD_NUMBER~')) $text = str_replace('~SHOULD_ADD_NUMBER~', $Group->AddNumber, $text); |
||||
236 | $Group->MSGs->$key->MSG = $text; |
||||
237 | } |
||||
238 | if (Get::$new_chat_member_id) { |
||||
239 | if ($Group->Settings->WelcomeMSGStatus->Value) { |
||||
240 | $msg = $Group->MSGs->WelcomeMSG->MSG; |
||||
241 | if ($Group->Settings->CaptchaStatus->Value && !$User->CaptchaStatus) { |
||||
242 | $msg .= PHP_EOL.PHP_EOL.'برای فعالیت در گروه ابتدا حساب خود را تایید کنید.'; |
||||
243 | $markup = Send::InlineKeyboardMarkup([ |
||||
244 | [ |
||||
245 | ['text' => 'من ربات نیستم', 'callback_data' => "/captchaVerify_$user_id"] |
||||
246 | ] |
||||
247 | ]); |
||||
248 | $send_return = Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null, $markup); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
249 | $DB->UpdateData('Users', $user_id, ['CaptchaSendNum' => ++$User->CaptchaSendNum], ['User_id' => $user_id]); |
||||
250 | $DB->InsertData('Bot', 'Temp', ['Type'=>'Captcha','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
251 | } else { |
||||
252 | $send_return = Send::sendMessage(Get::$chat_id, $msg, 'HTML'); |
||||
253 | $DB->InsertData('Bot', 'Temp', ['Type'=>'Welcome','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
254 | } |
||||
255 | } elseif ($Group->Settings->CaptchaStatus->Value && !$User->CaptchaStatus) { |
||||
256 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->CaptchaMSG->MSG, 'HTML'); |
||||
257 | $DB->InsertData('Bot', 'Temp', ['Type'=>'Captcha','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
258 | } |
||||
259 | } elseif (!Get::$new_chat_member_id && !Get::$left_chat_member_id && strpos(Get::$callback_query_data ?? 'Null', '/captchaVerify_') === false) { |
||||
260 | if ($Group->Settings->CaptchaStatus->Value && !$User->CaptchaStatus) { |
||||
261 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
262 | if ($User->CaptchaSendNum <= 3) { |
||||
263 | $markup = Send::InlineKeyboardMarkup([ |
||||
264 | [ |
||||
265 | ['text' => 'من ربات نیستم', 'callback_data' => "/captchaVerify_$user_id"] |
||||
266 | ] |
||||
267 | ]); |
||||
268 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->CaptchaMSG->MSG, 'HTML', false, false, null, $markup); |
||||
269 | $DB->UpdateData('Users', $user_id, ['CaptchaSendNum' => ++$User->CaptchaSendNum], ['User_id' => $user_id]); |
||||
270 | $DB->InsertData('Bot', 'Temp', ['Type'=>'Captcha','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
271 | } else { |
||||
272 | $DB->InsertData('Users/BlackDir', 'ClintBotList', ['User_id' => $user_id, 'Time' => time()]); |
||||
273 | Chat::kickChatMember(Get::$chat_id, $user_id); |
||||
274 | } |
||||
275 | die(); |
||||
276 | } elseif ($Group->Settings->ForceTOAddInGP->Value && $Group->AddNumber > $Member->AddNumber) { |
||||
277 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
278 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->ForceADDMSG->MSG, 'HTML'); |
||||
279 | $DB->InsertData('Bot', 'Temp', ['Type'=>'ForceTOAddInGP','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
280 | die(); |
||||
281 | } elseif ($Group->Settings->DelLinkStatus->Value && in_array('url', array_column(Get::$entities, 'type'))) { |
||||
282 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
283 | die(); |
||||
284 | } elseif ($Group->Settings->DelTGLinkStatus->Value && (strpos('t.me',Get::$text ?? Get::$caption) || strpos('telegram.me',Get::$text ?? Get::$caption) || strpos('telegram.dog',Get::$text ?? Get::$caption))) { |
||||
285 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
286 | die(); |
||||
287 | } elseif ($Group->Settings->DelMentionStatus->Value && in_array('mention', array_column(Get::$entities, 'type'))) { |
||||
288 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
289 | die(); |
||||
290 | } elseif ($Group->Settings->DelForwardStatus->Value && Get::$forward_from_chat_type == 'channel' && !in_array(Get::$forward_from_chat_username,$Group->WhiteListChannels)) { |
||||
291 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
292 | die(); |
||||
293 | } elseif ($Group->Settings->ForceTOChannelJoin->Value) { |
||||
294 | $Channels="\n\n"; |
||||
295 | $NotJoin = false; |
||||
296 | foreach ($Group->GPChannels as $Channel) { |
||||
297 | $res = Chat::getChatMember('@'.$Channel, $user_id); |
||||
298 | if ($res->ok) { |
||||
299 | if ($res->result->status == 'left' || $res->result->status == 'kicked') { |
||||
300 | $NotJoin = true; |
||||
301 | $Channels .="@".$Channel."\n"; |
||||
302 | } |
||||
303 | } |
||||
304 | } |
||||
305 | if ($NotJoin) { |
||||
306 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
307 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->ForceChannelJoinMSG->MSG.$Channels, 'HTML'); |
||||
308 | $DB->InsertData('Bot', 'Temp', ['Type'=>'ForceTOChannelJoin','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
309 | } |
||||
310 | } |
||||
311 | if ($Group->Settings->DelFilterWordsStatus->Value ) { |
||||
312 | foreach($Group->WordsFilterList as $word){ |
||||
313 | if(preg_match("~$word~i", Get::$text)){ |
||||
314 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
315 | die(); |
||||
316 | } |
||||
317 | } |
||||
318 | } |
||||
319 | if ($Group->Settings->SpamReportStatus->Value || $Group->Settings->WarnInSpam->Value) { |
||||
320 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', $user_id, ['SpamCount' => ++$Member->SpamCount], ['User_id' => $user_id]); |
||||
321 | if (++$Member->SpamCount >= $Group->SpamNumberToReport && ($Member->SSCU + $Group->SpamTimeToReport) > time()) { |
||||
322 | if ($Group->Settings->WarnInSpam->Value) { |
||||
323 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', $user_id, ['WarnCount' => ++$Member->WarnCount], ['User_id' => $user_id]); |
||||
324 | if (++$Member->WarnCount > $Group->WarnNumberToRemove) { |
||||
325 | Chat::kickChatMember(Get::$chat_id, $user_id); |
||||
326 | } |
||||
327 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->BotWarnMSG->MSG, 'HTML'); |
||||
328 | $DB->InsertData('Bot', 'Temp', ['Type'=>'Warn','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
329 | } |
||||
330 | if ($Group->Settings->SpamReportStatus->Value) { |
||||
331 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->SpamReportMSG->MSG, 'HTML'); |
||||
332 | $DB->InsertData('Bot', 'Temp', ['Type'=>'Report','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
333 | } |
||||
334 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', $user_id, ['SpamCount' => 0,'SSCU' => time()], ['User_id' => $user_id]); |
||||
335 | $res = Chat::restrictChatMember(Get::$chat_id, $user_id, ['can_send_messages' => false], 10*60); |
||||
336 | die(); |
||||
337 | } elseif (($Member->SSCU + $Group->SpamTimeToReport) < time()) { |
||||
338 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', $user_id, ['SpamCount' => 0,'SSCU' => time()], ['User_id' => $user_id]); |
||||
339 | } |
||||
340 | } |
||||
341 | } |
||||
342 | } elseif (!in_array($user_id, $Group->WhiteListUsers)) { |
||||
343 | if (Get::$reply_to_from_id) { |
||||
344 | if (in_array($user_id, $sudors) && Get::$text == 'ثبت کریتور') { |
||||
345 | $Group->Creator = Get::$reply_to_from_id; |
||||
346 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Settings' => $Group->Settings], ['Chat_id' => Get::$chat_id]); |
||||
347 | Send::sendMessage(Get::$chat_id, 'کریتور با موفقیت ثبت شد', null, false, false, Get::$message_id); |
||||
348 | } elseif (in_array($user_id, $sudors) && Get::$text == 'افزودن به لیست سیاه') { |
||||
349 | if (Get::$reply_to_from_id != ($id = explode(':', getenv('TOKEN'))[0]) && !in_array(Get::$reply_to_from_id, $sudors)) { |
||||
350 | $InBlackList = $DB->SelectData('Users/BlackDir', 'BlackList', ['User_id' => Get::$reply_to_from_id]); |
||||
351 | if (!$InBlackList) { |
||||
352 | $res = Chat::kickChatMember(Get::$chat_id, Get::$reply_to_from_id); |
||||
353 | $DB->InsertData('Users/BlackDir', 'BlackList', ['User_id' => Get::$reply_to_from_id, 'Time' => time()]); |
||||
354 | if ($res->ok) { |
||||
355 | Send::sendMessage(Get::$chat_id, 'کاربر به لیست سیاه اضافه و از گروه ریمو شد', null, false, false, Get::$message_id); |
||||
356 | } else { |
||||
357 | Send::sendMessage(Get::$chat_id, 'کاربر به لیست سیاه اضافه شد اما به علت :'.PHP_EOL.$res->description.PHP_EOL.'از گروه ریمو نشد', null, false, false, Get::$message_id); |
||||
358 | } |
||||
359 | } else { |
||||
360 | Send::sendMessage(Get::$chat_id, 'کاربر از قبل در لیست سیاه وجود داشت', null, false, false, Get::$message_id); |
||||
361 | } |
||||
362 | } else { |
||||
363 | Send::sendMessage(Get::$chat_id, 'امکان مسدود سازی ادمین وجود ندارد!', null, false, false, Get::$message_id); |
||||
364 | } |
||||
365 | } elseif (in_array($user_id, $sudors) && Get::$text == 'حذف از لیست سیاه') { |
||||
366 | $DB->DeleteData('Users/BlackDir', 'BlackList', ['User_id' => Get::$reply_to_from_id]); |
||||
367 | Send::sendMessage(Get::$chat_id, 'کاربر از لیست سیاه حذف شد', null, false, false, Get::$message_id); |
||||
368 | } elseif ((in_array($user_id, $sudors) || $user_id == $Group->Creator) && Get::$text == 'ثبت ادمین') { |
||||
369 | if (!in_array(Get::$reply_to_from_id, $Group->Administrators)) { |
||||
370 | $Group->Administrators[] = Get::$reply_to_from_id; |
||||
371 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Administrators' => $Group->Administrators], ['Chat_id' => Get::$chat_id]); |
||||
372 | Send::sendMessage(Get::$chat_id, 'ادمین با موفقیت ثبت شد', null, false, false, Get::$message_id); |
||||
373 | } else { |
||||
374 | Send::sendMessage(Get::$chat_id, 'ادمین از قبل وجود داشت', null, false, false, Get::$message_id); |
||||
375 | } |
||||
376 | } elseif ((in_array($user_id, $sudors) || $user_id == $Group->Creator) && Get::$text == 'حذف ادمین') { |
||||
377 | $new_admins = []; |
||||
378 | foreach ($Group->Administrators as $admin) { |
||||
379 | if ($admin != Get::$reply_to_from_id) { |
||||
380 | $new_admins[] = $admin; |
||||
381 | } |
||||
382 | } |
||||
383 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Administrators' => $new_admins], ['Chat_id' => Get::$chat_id]); |
||||
384 | Send::sendMessage(Get::$chat_id, 'ادمین با موفقیت حذف شد', null, false, false, Get::$message_id); |
||||
385 | } elseif (Get::$text == 'اخطار') { |
||||
386 | if (Get::$reply_to_from_id != ($id = explode(':', getenv('TOKEN'))[0]) && !in_array(Get::$reply_to_from_id, $sudors) && !in_array(Get::$reply_to_from_id, $Group->Administrators)) { |
||||
387 | $Member = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', Get::$reply_to_from_id, ['User_id' => Get::$reply_to_from_id]); |
||||
388 | $Member->WarnCount = $Member->WarnCount +1; |
||||
389 | $text = $Group->MSGs->WarnMSG->MSG; |
||||
390 | if (strpos($text, '-MENTION')) $text = preg_replace('/-MENTION=(~.*?~)(.*?)-/',"<a href='tg://user?id=$1'>$2</a>",$text); |
||||
391 | if (strpos($text, '~USER_ID~')) $text = str_replace('~USER_ID~', Get::$from_id, $text); |
||||
392 | if (strpos($text, '~FIRST_NAME~')) $text = str_replace('~FIRST_NAME~', Get::$from_first_name, $text); |
||||
393 | if (strpos($text, '~LAST_NAME~')) $text = str_replace('~LAST_NAME~', Get::$from_last_name, $text); |
||||
394 | if (strpos($text, '~USERNAME~')) $text = str_replace('~USERNAME~', Get::$from_username, $text); |
||||
395 | // |
||||
396 | if (strpos($text, '~GROUP_ID~')) $text = str_replace('~GROUP_ID~', '@' . Get::$chat_id, $text); |
||||
397 | if (strpos($text, '~GROUP_TITLE~')) $text = str_replace('~GROUP_TITLE~', Get::$chat_title, $text); |
||||
398 | if (strpos($text, '~GROUP_USERNAME~')) $text = str_replace('~GROUP_USERNAME~', '@' . Get::$chat_username, $text); |
||||
399 | // |
||||
400 | if (strpos($text, '~NEW_USER_ID~')) $text = str_replace('~NEW_USER_ID~', Get::$new_chat_member_id, $text); |
||||
401 | if (strpos($text, '~NEW_FIRST_NAME~')) $text = str_replace('~NEW_FIRST_NAME~', Get::$new_chat_member_first_name, $text); |
||||
402 | if (strpos($text, '~NEW_LAST_NAME~')) $text = str_replace('~NEW_LAST_NAME~', Get::$new_chat_member_last_name, $text); |
||||
403 | if (strpos($text, '~NEW_USERNAME~')) $text = str_replace('~NEW_USERNAME~', Get::$new_chat_member_username, $text); |
||||
404 | // |
||||
405 | if (strpos($text, '~IN_REPLY_ID~')) $text = str_replace('~IN_REPLY_ID~', Get::$reply_to_from_id, $text); |
||||
406 | if (strpos($text, '~IN_REPLY_FIRST_NAME~')) $text = str_replace('~IN_REPLY_FIRST_NAME~', Get::$reply_to_from_first_name, $text); |
||||
407 | if (strpos($text, '~IN_REPLY_LAST_NAME~')) $text = str_replace('~IN_REPLY_LAST_NAME~', Get::$reply_to_from_last_name, $text); |
||||
408 | if (strpos($text, '~IN_REPLY_USERNAME~')) $text = str_replace('~IN_REPLY_USERNAME~', Get::$reply_to_from_username, $text); |
||||
409 | // |
||||
410 | if (strpos($text, '~ENTER~')) $text = str_replace('~ENTER~', "\n", $text); |
||||
411 | if (strpos($text, '~CREATOR_ID~')) $text = str_replace('~CREATOR_ID~', $Group->Creator, $text); |
||||
412 | if (strpos($text, '~GP_CHANNEL~')) $text = str_replace('~GP_CHANNEL~', $Group->Creator, $text); |
||||
413 | if (strpos($text, '~CAPTCHASENDNUM~')) $text = str_replace('~CAPTCHASENDNUM~', $User->CaptchaSendNum, $text); |
||||
414 | if (strpos($text, '~USERWARNCOUNT~')) $text = str_replace('~USERWARNCOUNT~', $Member->WarnCount, $text); |
||||
415 | if (strpos($text, '~WARNNUMBERTOREMOVE~')) $text = str_replace('~WARNNUMBERTOREMOVE~', $Group->WarnNumberToRemove, $text); |
||||
416 | if (strpos($text, '~ADD_NUMBER~')) $text = str_replace('~ADD_NUMBER~', $Member->AddNumber, $text); |
||||
417 | if (strpos($text, '~SHOULD_ADD_NUMBER~')) $text = str_replace('~SHOULD_ADD_NUMBER~', $Group->AddNumber, $text); |
||||
418 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', Get::$reply_to_from_id, ['WarnCount' => $Member->WarnCount], ['User_id' => Get::$reply_to_from_id]); |
||||
419 | if ($Member->WarnCount > $Group->WarnNumberToRemove) { |
||||
420 | Chat::kickChatMember(Get::$chat_id, Get::$reply_to_from_id); |
||||
421 | } |
||||
422 | $send_return = Send::sendMessage(Get::$chat_id, $text, 'HTML'); |
||||
423 | $DB->InsertData('Bot', 'Temp', ['Type'=>'Warn','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
424 | } else { |
||||
425 | Send::sendMessage(Get::$chat_id, 'امکان محدود سازی ادمین وجود ندارد!', null, false, false, Get::$message_id); |
||||
426 | } |
||||
427 | } elseif (Get::$text == 'حذف اخطار') { |
||||
428 | $Member = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', Get::$reply_to_from_id, ['User_id' => Get::$reply_to_from_id]); |
||||
429 | $Member->WarnCount = $Member->WarnCount -1; |
||||
430 | $text = $Group->MSGs->WarnMSG->MSG; |
||||
431 | if (strpos($text, '-MENTION')) $text = preg_replace('/-MENTION=(~.*?~)(.*?)-/',"<a href='tg://user?id=$1'>$2</a>",$text); |
||||
432 | if (strpos($text, '~USER_ID~')) $text = str_replace('~USER_ID~', Get::$from_id, $text); |
||||
433 | if (strpos($text, '~FIRST_NAME~')) $text = str_replace('~FIRST_NAME~', Get::$from_first_name, $text); |
||||
434 | if (strpos($text, '~LAST_NAME~')) $text = str_replace('~LAST_NAME~', Get::$from_last_name, $text); |
||||
435 | if (strpos($text, '~USERNAME~')) $text = str_replace('~USERNAME~', Get::$from_username, $text); |
||||
436 | // |
||||
437 | if (strpos($text, '~GROUP_ID~')) $text = str_replace('~GROUP_ID~', '@' . Get::$chat_id, $text); |
||||
438 | if (strpos($text, '~GROUP_TITLE~')) $text = str_replace('~GROUP_TITLE~', Get::$chat_title, $text); |
||||
439 | if (strpos($text, '~GROUP_USERNAME~')) $text = str_replace('~GROUP_USERNAME~', '@' . Get::$chat_username, $text); |
||||
440 | // |
||||
441 | if (strpos($text, '~NEW_USER_ID~')) $text = str_replace('~NEW_USER_ID~', Get::$new_chat_member_id, $text); |
||||
442 | if (strpos($text, '~NEW_FIRST_NAME~')) $text = str_replace('~NEW_FIRST_NAME~', Get::$new_chat_member_first_name, $text); |
||||
443 | if (strpos($text, '~NEW_LAST_NAME~')) $text = str_replace('~NEW_LAST_NAME~', Get::$new_chat_member_last_name, $text); |
||||
444 | if (strpos($text, '~NEW_USERNAME~')) $text = str_replace('~NEW_USERNAME~', Get::$new_chat_member_username, $text); |
||||
445 | // |
||||
446 | if (strpos($text, '~IN_REPLY_ID~')) $text = str_replace('~IN_REPLY_ID~', Get::$reply_to_from_id, $text); |
||||
447 | if (strpos($text, '~IN_REPLY_FIRST_NAME~')) $text = str_replace('~IN_REPLY_FIRST_NAME~', Get::$reply_to_from_first_name, $text); |
||||
448 | if (strpos($text, '~IN_REPLY_LAST_NAME~')) $text = str_replace('~IN_REPLY_LAST_NAME~', Get::$reply_to_from_last_name, $text); |
||||
449 | if (strpos($text, '~IN_REPLY_USERNAME~')) $text = str_replace('~IN_REPLY_USERNAME~', Get::$reply_to_from_username, $text); |
||||
450 | // |
||||
451 | if (strpos($text, '~ENTER~')) $text = str_replace('~ENTER~', "\n", $text); |
||||
452 | if (strpos($text, '~CREATOR_ID~')) $text = str_replace('~CREATOR_ID~', $Group->Creator, $text); |
||||
453 | if (strpos($text, '~GP_CHANNEL~')) $text = str_replace('~GP_CHANNEL~', $Group->Creator, $text); |
||||
454 | if (strpos($text, '~CAPTCHASENDNUM~')) $text = str_replace('~CAPTCHASENDNUM~', $User->CaptchaSendNum, $text); |
||||
455 | if (strpos($text, '~USERWARNCOUNT~')) $text = str_replace('~USERWARNCOUNT~', $Member->WarnCount, $text); |
||||
456 | if (strpos($text, '~WARNNUMBERTOREMOVE~')) $text = str_replace('~WARNNUMBERTOREMOVE~', $Group->WarnNumberToRemove, $text); |
||||
457 | if (strpos($text, '~ADD_NUMBER~')) $text = str_replace('~ADD_NUMBER~', $Member->AddNumber, $text); |
||||
458 | if (strpos($text, '~SHOULD_ADD_NUMBER~')) $text = str_replace('~SHOULD_ADD_NUMBER~', $Group->AddNumber, $text); |
||||
459 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', Get::$reply_to_from_id, ['WarnCount' => $Member->WarnCount], ['User_id' => Get::$reply_to_from_id]); |
||||
460 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->delWarnMSG->MSG, 'HTML'); |
||||
461 | $DB->InsertData('Bot', 'Temp', ['Type'=>'Warn','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
462 | } elseif (Get::$text == 'افزودن به لیست سفید') { |
||||
463 | if (!in_array(Get::$reply_to_from_id, $Group->WhiteListUsers)) { |
||||
464 | $Group->WhiteListUsers[] = Get::$reply_to_from_id; |
||||
465 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $Group->WhiteListUsers], ['Chat_id' => Get::$chat_id]); |
||||
466 | Send::sendMessage(Get::$chat_id, 'کاربر با موفقیت به لیست سفید اضافه شد', null, false, false, Get::$message_id); |
||||
467 | } else { |
||||
468 | Send::sendMessage(Get::$chat_id, 'کاربر از قبل در لیست وجود داشت', null, false, false, Get::$message_id); |
||||
469 | } |
||||
470 | } elseif (Get::$text == 'حذف از لیست سفید') { |
||||
471 | $new_list = []; |
||||
472 | foreach ($Group->WhiteListUsers as $WhiteListUser) { |
||||
473 | if ($WhiteListUser != Get::$reply_to_from_id) { |
||||
474 | $new_list[] = $WhiteListUser; |
||||
475 | } |
||||
476 | } |
||||
477 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
478 | Send::sendMessage(Get::$chat_id, 'کاربر از لیست سفید حذف شد', null, false, false, Get::$message_id); |
||||
479 | } elseif (Get::$text == 'ریمو') { |
||||
480 | if (Get::$reply_to_from_id != ($id = explode(':', getenv('TOKEN'))[0]) && !in_array(Get::$reply_to_from_id, $sudors)) { |
||||
481 | $res = Chat::kickChatMember(Get::$chat_id, Get::$reply_to_from_id); |
||||
482 | if ($res->ok) { |
||||
483 | Send::sendMessage(Get::$chat_id, 'کاربر ریمو شد', null, false, false, Get::$message_id); |
||||
484 | } else { |
||||
485 | Send::sendMessage(Get::$chat_id, 'کاربر به علت :'.PHP_EOL.$res->description.PHP_EOL.'ریمو نشد', null, false, false, Get::$message_id); |
||||
486 | } |
||||
487 | } else { |
||||
488 | Send::sendMessage(Get::$chat_id, 'امکان ریمو کردن ادمین وجود ندارد!', null, false, false, Get::$message_id); |
||||
489 | } |
||||
490 | } elseif (preg_match('~^سکوت ([0-9]*)$~', Get::$text, $match)) { |
||||
491 | if (Get::$reply_to_from_id != ($id = explode(':', getenv('TOKEN'))[0]) && !in_array(Get::$reply_to_from_id, $sudors)) { |
||||
492 | $res = Chat::restrictChatMember(Get::$chat_id, Get::$reply_to_from_id, ['can_send_messages' => false], $match[1]*60); |
||||
493 | if ($res->ok) { |
||||
494 | Send::sendMessage(Get::$chat_id, 'کاربر به مدت ' . $match[1] . ' دقیقه محدود شد', null, false, false, Get::$message_id); |
||||
495 | } else { |
||||
496 | Send::sendMessage(Get::$chat_id, 'کاربر به علت :'.PHP_EOL.$res->description.PHP_EOL.'محدود نشد', null, false, false, Get::$message_id); |
||||
497 | } |
||||
498 | } else { |
||||
499 | Send::sendMessage(Get::$chat_id, 'امکان محدود سازی ادمین وجود ندارد!', null, false, false, Get::$message_id); |
||||
500 | } |
||||
501 | } |
||||
502 | } else { |
||||
503 | if ((in_array($user_id, $sudors) || $user_id == $Group->Creator) && Get::$text == 'لیست ادمین ها') { |
||||
504 | $msg = 'لیست ادمین های گروه'; |
||||
505 | foreach ($Group->Administrators as $admin) { |
||||
506 | $msg .= PHP_EOL."<a href='tg://user?id=$admin'>$admin</a>"; |
||||
507 | } |
||||
508 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
509 | } elseif (Get::$text == 'لیست سفید') { |
||||
510 | $msg = '<strong>'.'لیست سفید کاربران'.' : </strong>'; |
||||
511 | foreach ($Group->WhiteListUsers as $WhiteListUser) { |
||||
512 | $msg .= PHP_EOL."<a href='tg://user?id=$WhiteListUser'>$WhiteListUser</a>"; |
||||
513 | } |
||||
514 | $msg .= PHP_EOL.PHP_EOL.'<strong>'.'لیست سفید کانال ها'.' : </strong>'; |
||||
515 | foreach ($Group->WhiteListChannels as $WhiteListChannel) { |
||||
516 | $msg .= PHP_EOL.'@'.$WhiteListChannel; |
||||
517 | } |
||||
518 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
519 | } elseif (Get::$text == 'قفل کردن گروه') { |
||||
520 | Send::sendMessage(Get::$chat_id, 'گروه قفل شد', 'HTML', false, false, null); |
||||
521 | $permission = [ |
||||
522 | 'can_send_messages' => false, |
||||
523 | ]; |
||||
524 | Chat::setChatPermissions(Get::$chat_id, $permission); |
||||
525 | } elseif (Get::$text == 'باز کردن گروه') { |
||||
526 | Send::sendMessage(Get::$chat_id, 'گروه باز شد', 'HTML', false, false, null); |
||||
527 | $permission = [ |
||||
528 | 'can_send_polls' => true, |
||||
529 | 'can_send_other_messages' => true, |
||||
530 | 'can_add_web_page_previews' => true, |
||||
531 | 'can_invite_users' => true, |
||||
532 | ]; |
||||
533 | Chat::setChatPermissions(Get::$chat_id, $permission); |
||||
534 | } elseif (Get::$text == 'تنظیمات'|| strpos(Get::$callback_query_data ?? 'Null', '/disableProperty_') !== false || strpos(Get::$callback_query_data ?? 'Null', '/enableProperty_') !== false) { |
||||
535 | if (strpos(Get::$callback_query_data ?? 'Null', '/disableProperty_') !== false) { |
||||
536 | $Property = str_replace('/disableProperty_', '', Get::$callback_query_data); |
||||
537 | $Group->Settings->$Property->Value = false; |
||||
538 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Settings' => $Group->Settings], ['Chat_id' => Get::$chat_id]); |
||||
539 | } elseif (strpos(Get::$callback_query_data ?? 'Null', '/enableProperty_') !== false) { |
||||
540 | $Property = str_replace('/enableProperty_', '', Get::$callback_query_data); |
||||
541 | $Group->Settings->$Property->Value = true; |
||||
542 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Settings' => $Group->Settings], ['Chat_id' => Get::$chat_id]); |
||||
543 | } |
||||
544 | $keys = [[]]; |
||||
545 | foreach ($Group->Settings as $key => $value) { |
||||
546 | if ($value->Value) { |
||||
547 | $keys[][] = ['text' => $value->name . ' - ✅', 'callback_data' => '/disableProperty_' . $key]; |
||||
548 | } else { |
||||
549 | $keys[][] = ['text' => $value->name . ' - ❌', 'callback_data' => '/enableProperty_' . $key]; |
||||
550 | } |
||||
551 | } |
||||
552 | $markup = Send::InlineKeyboardMarkup($keys); |
||||
553 | |||||
554 | if (strpos(Get::$callback_query_data ?? 'Null', '/disableProperty_') !== false || strpos(Get::$callback_query_data ?? 'Null', '/enableProperty_') !== false) { |
||||
555 | Edit::editMessageReplyMarkup(Get::$chat_id, Get::$message_id, null, $markup); |
||||
0 ignored issues
–
show
$markup of type string is incompatible with the type array|null expected by parameter $reply_markup of AnarchyService\SendReque...ditMessageReplyMarkup() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
556 | } else { |
||||
557 | Send::sendMessage(Get::$chat_id, 'لطفا برای فعال سازی یا غیر فعال سازی کلیک کنید', 'HTML', false, false, null, $markup); |
||||
558 | } |
||||
559 | } elseif (Get::$text == 'راهنما') { |
||||
560 | $msg = "<strong>دستورات عمومی :</strong> \nتنظیمات\nثبت ادمین (با ریپلای)\nحذف ادمین (با ریپلای)\nلیست ادمین ها\nریمو (با ریپلای)\nحذف 5 (حذف پیام های آخر بر حسب عدد)\nمیوت 5 (با ریپلای و بر حسب دقیقه)\nاخطار (با ریپلای)\nحذف اخطار (با ریپلای)\nقفل کردن گروه\nباز کردن گروه\n\n <strong>تغییر متن پیامهای ربات :</strong> \nلیست پیام ها\n\n <strong>فیلتر کلمات در گروه :</strong>\nفیلتر کلمه\nحذف فیلتر کلمه\nلیست فیلتر\n\n<strong>عضویت اجباری در کانالها :</strong>\nافزودن کانال آیدی\nحذف کانال آیدی\nلیست کانال ها\n\n <strong>متغیرها :</strong> \n\n~FIRST_NAME~\n~LAST_NAME~\n~USERNAME~\n~USER_ID~\n~GROUP_ID~\n~GROUP_TITLE~\n~GROUP_USERNAME~\n~NEW_USER_ID~\n~NEW_LAST_NAME~\n~NEW_USERNAME~"; |
||||
561 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
562 | } elseif (Get::$text == 'لیست پیام ها') { |
||||
563 | $msg = 'پیام ها :'; |
||||
564 | foreach ($Group->MSGs as $MSG) { |
||||
565 | $msg .= PHP_EOL.PHP_EOL.'<strong>'.$MSG->name.' : </strong>'.PHP_EOL.$MSG->MSG; |
||||
566 | } |
||||
567 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
568 | } elseif (Get::$text == 'لیست کانال ها') { |
||||
569 | $msg = 'کانال ها :'; |
||||
570 | foreach ($Group->GPChannels as $GPChannel) { |
||||
571 | $msg .= PHP_EOL.'@'.$GPChannel; |
||||
572 | } |
||||
573 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
574 | } elseif (Get::$text == 'لیست فیلتر') { |
||||
575 | $msg = 'کلمات فیلتر شده :'; |
||||
576 | foreach ($Group->WordsFilterList as $Words) { |
||||
577 | $msg .= PHP_EOL.$Words; |
||||
578 | } |
||||
579 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
580 | } elseif (preg_match('~^افزودن به لیست سفید (.*)$~', Get::$text, $match)) { |
||||
581 | if (is_int($match[1])) { |
||||
582 | if (!in_array($match[1], $Group->WhiteListUsers)) { |
||||
583 | $Group->WhiteListUsers[] = $match[1]; |
||||
584 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $Group->WhiteListUsers], ['Chat_id' => Get::$chat_id]); |
||||
585 | Send::sendMessage(Get::$chat_id, 'کاربر با موفقیت به لیست سفید اضافه شد', null, false, false, Get::$message_id); |
||||
586 | } else { |
||||
587 | Send::sendMessage(Get::$chat_id, 'کاربر از قبل در لیست وجود داشت!', null, false, false, Get::$message_id); |
||||
588 | } |
||||
589 | } elseif (substr($match[1], 0, 1) == '@') { |
||||
590 | $Channel = trim($match[1], '@'); |
||||
591 | if (!in_array($Channel, $Group->WhiteListChannels)) { |
||||
592 | $Group->WhiteListChannels[] = $Channel; |
||||
593 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListChannels' => $Group->WhiteListChannels], ['Chat_id' => Get::$chat_id]); |
||||
594 | Send::sendMessage(Get::$chat_id, 'کانال با موفقیت به لیست سفید اضافه شد', null, false, false, Get::$message_id); |
||||
595 | } else { |
||||
596 | Send::sendMessage(Get::$chat_id, 'کانال از قبل در لیست وجود داشت!', null, false, false, Get::$message_id); |
||||
597 | } |
||||
598 | } else { |
||||
599 | Send::sendMessage(Get::$chat_id, 'فرمت ارسالی پشتیبانی نمیشود!', null, false, false, Get::$message_id); |
||||
600 | } |
||||
601 | } elseif (preg_match('~^حذف از لیست سفید (.*)$~', Get::$text, $match)) { |
||||
602 | if (is_int($match[1])) { |
||||
603 | $new_list = []; |
||||
604 | foreach ($Group->WhiteListUsers as $WhiteListUser) { |
||||
605 | if ($WhiteListUser != $match[1]) { |
||||
606 | $new_list[] = $WhiteListUser; |
||||
607 | } |
||||
608 | } |
||||
609 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
610 | Send::sendMessage(Get::$chat_id, 'کاربر از لیست سفید حذف شد', null, false, false, Get::$message_id); |
||||
611 | } elseif (substr($match[1], 0, 1) == '@') { |
||||
612 | $new_list = []; |
||||
613 | foreach ($Group->WhiteListChannels as $WhiteListChannel) { |
||||
614 | if ($WhiteListChannel != trim($match[1], '@')) { |
||||
615 | $new_list[] = $WhiteListChannel; |
||||
616 | } |
||||
617 | } |
||||
618 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListChannels' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
619 | Send::sendMessage(Get::$chat_id, 'کانال از لیست سفید حذف شد', null, false, false, Get::$message_id); |
||||
620 | } else { |
||||
621 | Send::sendMessage(Get::$chat_id, 'فرمت ارسال پشتیبانی نمیشود!', null, false, false, Get::$message_id); |
||||
622 | } |
||||
623 | } elseif (preg_match('~^افزودن کانال (@.*)$~', Get::$text, $match)) { |
||||
624 | $Channel = trim($match[1], '@'); |
||||
625 | if (!in_array($Channel, $Group->GPChannels)) { |
||||
626 | $Group->GPChannels[] = $Channel; |
||||
627 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['GPChannels' => $Group->GPChannels], ['Chat_id' => Get::$chat_id]); |
||||
628 | Send::sendMessage(Get::$chat_id, 'کانال با موفقیت به لیست اضافه شد', null, false, false, Get::$message_id); |
||||
629 | } else { |
||||
630 | Send::sendMessage(Get::$chat_id, 'کانال از قبل در لیست وجود داشت!', null, false, false, Get::$message_id); |
||||
631 | } |
||||
632 | } elseif (preg_match('~^حذف کانال (@.*)$~', Get::$text, $match)) { |
||||
633 | $new_list = []; |
||||
634 | foreach ($Group->GPChannels as $GPChannels) { |
||||
635 | if ($GPChannels != trim($match[1], '@')) { |
||||
636 | $new_list[] = $GPChannels; |
||||
637 | } |
||||
638 | } |
||||
639 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['GPChannels' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
640 | Send::sendMessage(Get::$chat_id, 'کانال از لیست حذف شد', null, false, false, Get::$message_id); |
||||
641 | } elseif (preg_match('~^فیلتر (.*)$~', Get::$text, $match)) { |
||||
642 | if (!in_array($match[1], $Group->WordsFilterList)) { |
||||
643 | $Group->WordsFilterList[] = $match[1]; |
||||
644 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WordsFilterList' => $Group->WordsFilterList], ['Chat_id' => Get::$chat_id]); |
||||
645 | Send::sendMessage(Get::$chat_id, 'کلمه با موفقیت به لیست اضافه شد', null, false, false, Get::$message_id); |
||||
646 | } else { |
||||
647 | Send::sendMessage(Get::$chat_id, 'کلمه از قبل در لیست وجود داشت!', null, false, false, Get::$message_id); |
||||
648 | } |
||||
649 | } elseif (preg_match('~^حذف فیلتر (.*)$~', Get::$text, $match)) { |
||||
650 | $new_list = []; |
||||
651 | foreach ($Group->WordsFilterList as $Word) { |
||||
652 | if ($Word != $match[1]) { |
||||
653 | $new_list[] = $Word; |
||||
654 | } |
||||
655 | } |
||||
656 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WordsFilterList' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
657 | Send::sendMessage(Get::$chat_id, 'کلمه از لیست حذف شد', null, false, false, Get::$message_id); |
||||
658 | } elseif (preg_match('~^تغییر اد ([0-9]*)$~', Get::$text, $match)) { |
||||
659 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['AddNumber' => $match[1]], ['Chat_id' => Get::$chat_id]); |
||||
660 | Send::sendMessage(Get::$chat_id, 'تعداد اد باموفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
661 | } elseif (preg_match('~^حذف ادمین ([0-9]*)$~', Get::$text, $match)) { |
||||
662 | if (!in_array($match[1], $Group->WhiteListUsers)) { |
||||
663 | $Group->WhiteListUsers[] = $match[1]; |
||||
664 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $Group->WhiteListUsers], ['Chat_id' => Get::$chat_id]); |
||||
665 | Send::sendMessage(Get::$chat_id, 'کاربر با موفقیت به لیست سفید اضافه شد', null, false, false, Get::$message_id); |
||||
666 | } else { |
||||
667 | Send::sendMessage(Get::$chat_id, 'کاربر از قبل در لیست وجود داشت', null, false, false, Get::$message_id); |
||||
668 | } |
||||
669 | } elseif (preg_match('~^ثبت ادمین ([0-9]*)$~', Get::$text, $match)) { |
||||
670 | $new_list = []; |
||||
671 | foreach ($Group->WhiteListUsers as $WhiteListUser) { |
||||
672 | if ($WhiteListUser != $match[1]) { |
||||
673 | $new_list[] = $WhiteListUser; |
||||
674 | } |
||||
675 | } |
||||
676 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
677 | Send::sendMessage(Get::$chat_id, 'کاربر از لیست سفید حذف شد', null, false, false, Get::$message_id); |
||||
678 | } elseif (preg_match('~^حذف ([0-9]*)$~', Get::$text, $match)) { |
||||
679 | if ($match[1] <= 20) { |
||||
680 | $end = Get::$message_id - $match[1]; |
||||
681 | for ($i = Get::$message_id; $i >= $end; $i--) { |
||||
682 | Chat::deleteMessage(Get::$chat_id, $i); |
||||
683 | } |
||||
684 | } else { |
||||
685 | Send::sendMessage(Get::$chat_id, 'در حال حاظر محدودیت 20 عددی وجود دارد.'); |
||||
686 | } |
||||
687 | } elseif (preg_match('~^تغییر پیام خوش آمدگویی (.*)~', Get::$text, $match)) { |
||||
688 | $Group->MSGs->WelcomeMSG->MSG = $match[1]; |
||||
689 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
690 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
691 | } elseif (preg_match('~^تغییر پیام کپچا (.*)~', Get::$text, $match)) { |
||||
692 | $Group->MSGs->CaptchaMSG->MSG = $match[1]; |
||||
693 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
694 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
695 | } elseif (preg_match('~^تغییر پیام عضویت اجباری (.*)~', Get::$text, $match)) { |
||||
696 | $Group->MSGs->ForceChannelJoinMSG->MSG = $match[1]; |
||||
697 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
698 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
699 | } elseif (preg_match('~^تغییر پیام اد اجباری (.*)~', Get::$text, $match)) { |
||||
700 | $Group->MSGs->ForceADDMSG->MSG = $match[1]; |
||||
701 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
702 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
703 | } elseif (preg_match('~^تغییر پیام گذارش اسپم (.*)~', Get::$text, $match)) { |
||||
704 | $Group->MSGs->SpamReportMSG->MSG = $match[1]; |
||||
705 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
706 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
707 | } elseif (preg_match('~^تغییر پیام اخطار (.*)~', Get::$text, $match)) { |
||||
708 | $Group->MSGs->WarnMSG->MSG = $match[1]; |
||||
709 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
710 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
711 | } elseif (preg_match('~^تغییر پیام اخطار اسپم (.*)~', Get::$text, $match)) { |
||||
712 | $Group->MSGs->BotWarnMSG->MSG = $match[1]; |
||||
713 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
714 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
715 | } elseif (preg_match('~^تغییر پیام حذف اخطار (.*)~', Get::$text, $match)) { |
||||
716 | $Group->MSGs->delWarnMSG->MSG = $match[1]; |
||||
717 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
718 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
719 | } |
||||
720 | } |
||||
721 | } |
||||
722 | $DB->UpdateData('Users/', $user_id, ['MSGCount' => ++$User->MSGCount], ['User_id' => $user_id]); |
||||
723 | if (Get::$reply_to_from_id){ |
||||
724 | if (Get::$text == 'ممنون' || Get::$text == 'خیلی ممنون' || Get::$text == 'متشکر' || Get::$text == 'تشکر' || Get::$text == 'دمت گرم' || Get::$text == 'دمتون گرم' || Get::$text == 'لطف کردین' || Get::$text == 'مچکر' || Get::$text == 'خیلی ممنونم' || Get::$text == 'ممنونم' || Get::$text == 'متشکرم'){ |
||||
725 | if ($User->LTU + 60*10 < time() && Get::$reply_to_from_id != Get::$from_id) { |
||||
726 | $User = $DB->SelectData('Users', Get::$reply_to_from_id, ['User_id' => Get::$reply_to_from_id]); |
||||
727 | $DB->UpdateData('Users/' , Get::$reply_to_from_id, ['ThankCount' => ++$User->ThankCount], ['User_id' => Get::$reply_to_from_id]); |
||||
728 | } |
||||
729 | } elseif ((Get::$text == 'فارسی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
730 | $msg = GoogleTranslate::translate('auto', 'fa', $text); |
||||
731 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
732 | } elseif ((Get::$text == 'انگلیسی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
733 | $msg = GoogleTranslate::translate('auto', 'en', $text); |
||||
734 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
735 | } elseif ((Get::$text == 'ایتالیایی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
736 | $msg = GoogleTranslate::translate('auto', 'it', $text); |
||||
737 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
738 | } elseif ((Get::$text == 'فرانسوی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
739 | $msg = GoogleTranslate::translate('auto', 'fr', $text); |
||||
740 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
741 | } elseif ((Get::$text == 'آلمانی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
742 | $msg = GoogleTranslate::translate('auto', 'de', $text); |
||||
743 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
744 | } elseif ((Get::$text == 'ترکی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
745 | $msg = GoogleTranslate::translate('auto', 'tr', $text); |
||||
746 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
747 | } elseif ((Get::$text == 'عربی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
748 | $msg = GoogleTranslate::translate('auto', 'ar', $text); |
||||
749 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
750 | } elseif ((Get::$text == 'ژاپنی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
751 | $msg = GoogleTranslate::translate('auto', 'ja', $text); |
||||
752 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
753 | } elseif ((Get::$text == 'چینی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
754 | $msg = GoogleTranslate::translate('auto', 'zh', $text); |
||||
755 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
756 | } |
||||
757 | } else { |
||||
758 | if ($Group->Settings->InfoMSGStatus->Value && (preg_match('~^(ربات)? ?من$~', Get::$text) || preg_match('~^me$~i', Get::$text) || preg_match('~^info$~i', Get::$text))) { |
||||
759 | $UserInfo = Get::getUserProfilePhotos(Get::$from_id); |
||||
760 | if ($UserInfo->ok) { |
||||
761 | if ($Member->ThankCount > 1000) { |
||||
762 | $Position = '⭐⭐⭐⭐⭐'; |
||||
763 | } elseif ($Member->ThankCount > 500) { |
||||
764 | $Position = '⭐⭐⭐⭐'; |
||||
765 | } elseif ($Member->ThankCount > 200) { |
||||
766 | $Position = '⭐⭐⭐'; |
||||
767 | } elseif ($Member->ThankCount > 100) { |
||||
768 | $Position = '⭐⭐'; |
||||
769 | } elseif ($Member->ThankCount < 10) { |
||||
770 | $Position = '⭐'; |
||||
771 | } |
||||
772 | $photo = end($UserInfo->result->photos[0])->file_id; |
||||
773 | $msg = 'نام : '.Get::$from_first_name.' '.Get::$from_last_name; |
||||
774 | if(Get::$from_username) $msg .="\n\n نام کاربری : ".Get::$from_username; |
||||
775 | $msg .="\n\n یوزر آیدی : ".Get::$from_id."\n\n تعداد پیام های ارسالی در گروهها : ".$User->MSGCount."\n\n تعداد تشکر ها : ".$User->ThankCount .PHP_EOL.PHP_EOL; |
||||
776 | if ($Member->WarnCount > 0) { |
||||
777 | $msg .= "اخطارها : $Member->WarnCount \n \n "; |
||||
778 | } |
||||
779 | $msg .= "رتبه : $Position"; |
||||
780 | if ($photo) { |
||||
781 | Send::sendPhoto(Get::$chat_id , $photo , $msg ,null , false , Get::$message_id); |
||||
782 | } else { |
||||
783 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
784 | } |
||||
785 | } |
||||
786 | } elseif (preg_match('~ساعت ?چن?د?ه?~', Get::$text)) { |
||||
787 | Send::sendMessage(Get::$chat_id, jdate('h : i'), null, false, false, Get::$message_id); |
||||
788 | } elseif (preg_match('~امروز ?چندمه?~', Get::$text)) { |
||||
789 | Send::sendMessage(Get::$chat_id, jdate('d F'), null, false, false, Get::$message_id); |
||||
790 | } elseif (preg_match('~امروز ?چند ?شنب~', Get::$text)) { |
||||
791 | Send::sendMessage(Get::$chat_id, jdate('l'), null, false, false, Get::$message_id); |
||||
792 | } elseif (strpos(Get::$callback_query_data ?? 'Null', '/captchaVerify_') !== false) { |
||||
793 | $explode_user_id = explode('_', Get::$callback_query_data)[1]; |
||||
794 | if ($user_id == $explode_user_id) { |
||||
795 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
796 | $DB->UpdateData('Users', $user_id, ['CaptchaStatus' => true], ['User_id' => $user_id]); |
||||
797 | } |
||||
798 | } elseif ($Group->Settings->ConversationStatus->Value && in_array(Get::$text, array_keys(get_object_vars($words = $DB->SelectData('Bot','Words'))))) { |
||||
0 ignored issues
–
show
It seems like
$words = $DB->SelectData('Bot', 'Words') can also be of type array ; however, parameter $object of get_object_vars() does only seem to accept object , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
799 | $text = Get::$text; |
||||
800 | $msg = "اینم ".Get::$text." برای شما 😌 \n\n ".$words->$text; |
||||
801 | Send::sendMessage(Get::$chat_id , $msg ,null , false ,false, Get::$message_id); |
||||
802 | } elseif ($Group->Settings->ConversationStatus->Value && in_array(Get::$text, array_keys(get_object_vars($words = $DB->SelectData('Bot','conversation'))))) { |
||||
803 | $text = Get::$text; |
||||
804 | $rand_array = explode('&&&&', $words->$text); |
||||
805 | $num = sizeof($rand_array); |
||||
806 | Send::sendMessage(Get::$chat_id , $rand_array[rand(0, --$num)] ,null , false ,false, Get::$message_id); |
||||
807 | } |
||||
808 | } |
||||
809 | if ($Group->Settings->DelTGServicesStatus->Value && (Get::$new_chat_member_id || Get::$left_chat_member_id || Get::$new_chat_title || Get::$new_chat_photo_file_id)) { |
||||
810 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
811 | } |
||||
812 | foreach($DB->SelectData('Bot/', 'Temp') as $Temp){ |
||||
813 | if($Temp->Type == 'Welcome' && $Temp->Time + $Group->DelWlcMSGAfter < time()) Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
814 | if($Temp->Type == 'ForceTOAddInGP' && $Temp->Time + $Group->DelForceAddMSGAfter < time()) Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
815 | if($Temp->Type == 'ForceTOChannelJoin' && $Temp->Time + $Group->DelForceJoinMSGAfter < time()) Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
816 | if($Temp->Type == 'Captcha' && $Temp->Time + $Group->DelCaptchaMSGAfter < time()) Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
817 | if($Temp->Type == 'Warn' && $Temp->Time + $Group->DelWarnMSGAfter < time()) Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
818 | if($Temp->Type == 'Report' && $Temp->Time + $Group->DelReportMSGAfter < time()) Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
819 | } |
||||
820 | } |
||||
821 |