Anarchy-Service /
Anarchy-Bot
| 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\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::$new_chat_member_id ? [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 | ]; |
||||
| 109 | $DB->CreateTable('Groups/' . Get::$chat_id, Get::$chat_id, [ |
||||
| 110 | 'Working' => true, |
||||
| 111 | 'AddAt' => time(), |
||||
| 112 | 'Chat_id' => Get::$chat_id, |
||||
| 113 | 'Chat_title' => Get::$chat_title, |
||||
| 114 | 'ChargeEnd' => 0, |
||||
| 115 | 'BotAdder' => Get::$from_id, |
||||
| 116 | 'Creator' => $Creator, |
||||
| 117 | 'Administrators' => $Admins, |
||||
| 118 | 'WhiteListUsers' => [], |
||||
| 119 | 'WhiteListChannels' => [], |
||||
| 120 | 'WordsFilterList' => [], |
||||
| 121 | 'MSGs' => [ |
||||
| 122 | 'WelcomeMSG' => ['MSG'=>' سلام -MENTION=~NEW_USER_ID~~NEW_FIRST_NAME~- ~ENTER~ به گروه ~GROUP_TITLE~ خوش آمدید. ','name'=>'پیام خوش آمدگویی'], |
||||
| 123 | 'ForceADDMSG' => ['MSG'=>' سلام -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ برای ارسال پیام ابتدا ~SHOULD_ADD_NUMBER~ نفر اد کنید. ~ENTER~ تعداد اد شده توسط شما : ~ADD_NUMBER~','name'=>'پیام اد اجباری'], |
||||
| 124 | 'ForceChannelJoinMSG' => ['MSG'=>' سلام -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ برای ارسال پیام ابتدا عضو کانال های زیر شوید. ','name'=>'پیام عضویت اجباری'], |
||||
| 125 | 'CaptchaMSG' => ['MSG'=>' سلام -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ برای ارسال پیام ابتدا حساب کاربری خود را تایید کنید. ~ENTER~ 3/~CAPTCHASENDNUM~ ','name'=>'پیام کپچا'], |
||||
| 126 | 'SpamReportMSG' => ['MSG'=>' کاربر -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ تو گروه اسپم میکنه. ~ENTER~ -MENTION=~CREATOR_ID~ADMIN- ','name'=>'پیام گزارش اسپم'], |
||||
| 127 | 'WarnMSG' => ['MSG'=>' کاربر -MENTION=~IN_REPLY_ID~~IN_REPLY_FIRST_NAME~- ~ENTER~ یک اخطار به اخطار های شما اضافه شد ~ENTER~ ~USERWARNCOUNT~/~WARNNUMBERTOREMOVE~ ','name'=>'پیام اخطار'], |
||||
| 128 | 'delWarnMSG' => ['MSG'=>' کاربر -MENTION=~IN_REPLY_ID~~IN_REPLY_FIRST_NAME~- ~ENTER~ یک اخطار از اخطار های شما کسر شد ~ENTER~ ~USERWARNCOUNT~/~WARNNUMBERTOREMOVE~ ','name'=>'پیام حذف اخطار'], |
||||
| 129 | 'BotWarnMSG' => ['MSG'=>' کاربر -MENTION=~USER_ID~~FIRST_NAME~- ~ENTER~ یک اخطار به اخطار های شما اضافه شد ~ENTER~ ~USERWARNCOUNT~/~WARNNUMBERTOREMOVE~ ','name'=>'پیام اخطار اسپم'], |
||||
| 130 | ], |
||||
| 131 | 'DelWlcMSGAfter' => 5, |
||||
| 132 | 'DelForceAddMSGAfter' => 5, |
||||
| 133 | 'DelForceJoinMSGAfter' => 5, |
||||
| 134 | 'DelCaptchaMSGAfter' => 5, |
||||
| 135 | 'DelWarnMSGAfter' => 5, |
||||
| 136 | 'DelReportMSGAfter' => 5, |
||||
| 137 | 'SpamNumberToReport' => 5, |
||||
| 138 | 'SpamTimeToReport' => 5, |
||||
| 139 | 'WarnNumberToRemove' => 5, |
||||
| 140 | 'AddNumber' => 5, |
||||
| 141 | 'GPWarns' => 0, |
||||
| 142 | 'GPChannels' => [], |
||||
| 143 | 'PreviousMembersShouldJoin' => false, |
||||
| 144 | 'PreviousMembersShouldAdd' => false, |
||||
| 145 | 'PreviousMembersShouldVerifyCaptcha' => false, |
||||
| 146 | 'Settings' => $DefaultSettings |
||||
| 147 | ]); |
||||
| 148 | $msg = 'سلام' . PHP_EOL . 'برای فعال سازی رایگان ربات، من رو به عنوان ادمین گروه انتخاب کنید' . PHP_EOL . 'با فرستادن راهنما هم میتوانید آموزش استفاده از ربات را یاد بگیرید 😃'; |
||||
| 149 | Send::sendMessage(Get::$chat_id, $msg); |
||||
| 150 | $Group = $DB->SelectData('Groups/' . Get::$chat_id, Get::$chat_id, ['Chat_id' => Get::$chat_id]); |
||||
| 151 | } |
||||
| 152 | if ($Group->Working) { |
||||
| 153 | $user_id = Get::$new_chat_member_id ?? Get::$from_id; |
||||
| 154 | $IsClintBot = $DB->SelectData('Users/BlackDir', 'ClintBotList', ['User_id' => $user_id]); |
||||
| 155 | $InBlackList = $DB->SelectData('Users/BlackDir', 'BlackList', ['User_id' => $user_id]); |
||||
| 156 | $User = $DB->SelectData('Users', $user_id, ['User_id' => $user_id]); |
||||
| 157 | if ($IsClintBot || $InBlackList) { |
||||
| 158 | Chat::kickChatMember(Get::$chat_id, $user_id); |
||||
| 159 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 160 | die(); |
||||
| 161 | } elseif (!$User) { |
||||
| 162 | $DB->CreateTable('Users', $user_id, [ |
||||
| 163 | 'User_id' => $user_id, |
||||
| 164 | 'MSGCount' => 0, |
||||
| 165 | 'LTU' => 0, # Last Thank UnixTime |
||||
| 166 | 'ThankCount' => 0, |
||||
| 167 | 'CaptchaStatus' => false, |
||||
| 168 | 'CaptchaSendNum' => 0, |
||||
| 169 | ]); |
||||
| 170 | $User = $DB->SelectData('Users', $user_id, ['User_id' => $user_id]); |
||||
| 171 | } |
||||
| 172 | $Member = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', $user_id, ['User_id' => $user_id]); |
||||
| 173 | if (!$Member) { |
||||
| 174 | if (Get::$from_id != $user_id) { |
||||
| 175 | $adder = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', Get::$from_id, ['User_id' => Get::$from_id]); |
||||
| 176 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', Get::$from_id, ['AddNumber' => ++$adder->AddNumber], ['User_id' => Get::$from_id]); |
||||
| 177 | } |
||||
| 178 | $DB->CreateTable('Groups/' . Get::$chat_id . '/Users', $user_id, [ |
||||
| 179 | 'User_id' => $user_id, |
||||
| 180 | 'SSCU' => time(), # Start Spam Count UnixTime |
||||
| 181 | 'SpamCount' => 0, |
||||
| 182 | 'WarnCount' => 0, |
||||
| 183 | 'AddNumber' => 0, |
||||
| 184 | 'SendReportAt' => 0, |
||||
| 185 | 'AddDone' => !$Group->PreviousMembersShouldAdd && !Get::$new_chat_member_id, |
||||
| 186 | 'AddedBy' => (Get::$from_id != $user_id) ? Get::$from_id : 0, |
||||
| 187 | ]); |
||||
| 188 | $Member = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', $user_id, ['User_id' => $user_id]); |
||||
| 189 | } |
||||
| 190 | if (!in_array($user_id, $sudors) && $user_id != $Group->Creator && !in_array($user_id, $Group->Administrators) && !in_array($user_id, $Group->WhiteListUsers) && $user_id != ($id = explode(':', getenv('TOKEN'))[0])) { |
||||
| 191 | foreach ($Group->MSGs as $key => $value) { |
||||
| 192 | $text = $value->MSG; |
||||
| 193 | if (strpos($text, '-MENTION')) { |
||||
| 194 | $text = preg_replace('/-MENTION=(~.*?~)(.*?)-/', "<a href='tg://user?id=$1'>$2</a>", $text); |
||||
| 195 | } |
||||
| 196 | if (strpos($text, '~USER_ID~')) { |
||||
| 197 | $text = str_replace('~USER_ID~', Get::$from_id, $text); |
||||
| 198 | } |
||||
| 199 | if (strpos($text, '~FIRST_NAME~')) { |
||||
| 200 | $text = str_replace('~FIRST_NAME~', Get::$from_first_name, $text); |
||||
| 201 | } |
||||
| 202 | if (strpos($text, '~LAST_NAME~')) { |
||||
| 203 | $text = str_replace('~LAST_NAME~', Get::$from_last_name, $text); |
||||
| 204 | } |
||||
| 205 | if (strpos($text, '~USERNAME~')) { |
||||
| 206 | $text = str_replace('~USERNAME~', Get::$from_username, $text); |
||||
| 207 | } |
||||
| 208 | // |
||||
| 209 | if (strpos($text, '~GROUP_ID~')) { |
||||
| 210 | $text = str_replace('~GROUP_ID~', '@' . Get::$chat_id, $text); |
||||
| 211 | } |
||||
| 212 | if (strpos($text, '~GROUP_TITLE~')) { |
||||
| 213 | $text = str_replace('~GROUP_TITLE~', Get::$chat_title, $text); |
||||
| 214 | } |
||||
| 215 | if (strpos($text, '~GROUP_USERNAME~')) { |
||||
| 216 | $text = str_replace('~GROUP_USERNAME~', '@' . Get::$chat_username, $text); |
||||
| 217 | } |
||||
| 218 | // |
||||
| 219 | if (strpos($text, '~NEW_USER_ID~')) { |
||||
| 220 | $text = str_replace('~NEW_USER_ID~', Get::$new_chat_member_id, $text); |
||||
| 221 | } |
||||
| 222 | if (strpos($text, '~NEW_FIRST_NAME~')) { |
||||
| 223 | $text = str_replace('~NEW_FIRST_NAME~', Get::$new_chat_member_first_name, $text); |
||||
| 224 | } |
||||
| 225 | if (strpos($text, '~NEW_LAST_NAME~')) { |
||||
| 226 | $text = str_replace('~NEW_LAST_NAME~', Get::$new_chat_member_last_name, $text); |
||||
| 227 | } |
||||
| 228 | if (strpos($text, '~NEW_USERNAME~')) { |
||||
| 229 | $text = str_replace('~NEW_USERNAME~', Get::$new_chat_member_username, $text); |
||||
| 230 | } |
||||
| 231 | // |
||||
| 232 | if (strpos($text, '~IN_REPLY_ID~')) { |
||||
| 233 | $text = str_replace('~IN_REPLY_ID~', Get::$reply_to_from_id, $text); |
||||
| 234 | } |
||||
| 235 | if (strpos($text, '~IN_REPLY_FIRST_NAME~')) { |
||||
| 236 | $text = str_replace('~IN_REPLY_FIRST_NAME~', Get::$reply_to_from_first_name, $text); |
||||
| 237 | } |
||||
| 238 | if (strpos($text, '~IN_REPLY_LAST_NAME~')) { |
||||
| 239 | $text = str_replace('~IN_REPLY_LAST_NAME~', Get::$reply_to_from_last_name, $text); |
||||
| 240 | } |
||||
| 241 | if (strpos($text, '~IN_REPLY_USERNAME~')) { |
||||
| 242 | $text = str_replace('~IN_REPLY_USERNAME~', Get::$reply_to_from_username, $text); |
||||
| 243 | } |
||||
| 244 | // |
||||
| 245 | if (strpos($text, '~ENTER~')) { |
||||
| 246 | $text = str_replace('~ENTER~', "\n", $text); |
||||
| 247 | } |
||||
| 248 | if (strpos($text, '~CREATOR_ID~')) { |
||||
| 249 | $text = str_replace('~CREATOR_ID~', $Group->Creator, $text); |
||||
| 250 | } |
||||
| 251 | if (strpos($text, '~GP_CHANNEL~')) { |
||||
| 252 | $text = str_replace('~GP_CHANNEL~', $Group->Creator, $text); |
||||
| 253 | } |
||||
| 254 | if (strpos($text, '~CAPTCHASENDNUM~')) { |
||||
| 255 | $text = str_replace('~CAPTCHASENDNUM~', $User->CaptchaSendNum, $text); |
||||
| 256 | } |
||||
| 257 | if (strpos($text, '~USERWARNCOUNT~')) { |
||||
| 258 | $text = str_replace('~USERWARNCOUNT~', $Member->WarnCount, $text); |
||||
| 259 | } |
||||
| 260 | if (strpos($text, '~WARNNUMBERTOREMOVE~')) { |
||||
| 261 | $text = str_replace('~WARNNUMBERTOREMOVE~', $Group->WarnNumberToRemove, $text); |
||||
| 262 | } |
||||
| 263 | if (strpos($text, '~ADD_NUMBER~')) { |
||||
| 264 | $text = str_replace('~ADD_NUMBER~', $Member->AddNumber, $text); |
||||
| 265 | } |
||||
| 266 | if (strpos($text, '~SHOULD_ADD_NUMBER~')) { |
||||
| 267 | $text = str_replace('~SHOULD_ADD_NUMBER~', $Group->AddNumber, $text); |
||||
| 268 | } |
||||
| 269 | $Group->MSGs->$key->MSG = $text; |
||||
| 270 | } |
||||
| 271 | if (Get::$new_chat_member_id) { |
||||
| 272 | if ($Group->Settings->WelcomeMSGStatus->Value) { |
||||
| 273 | $msg = $Group->MSGs->WelcomeMSG->MSG; |
||||
| 274 | if ($Group->Settings->CaptchaStatus->Value && !$User->CaptchaStatus) { |
||||
| 275 | $msg .= PHP_EOL.PHP_EOL.'برای فعالیت در گروه ابتدا حساب خود را تایید کنید.'; |
||||
| 276 | $markup = Send::InlineKeyboardMarkup([ |
||||
| 277 | [ |
||||
| 278 | ['text' => 'من ربات نیستم', 'callback_data' => "/captchaVerify_$user_id"] |
||||
| 279 | ] |
||||
| 280 | ]); |
||||
| 281 | $send_return = Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null, $markup); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 282 | $DB->UpdateData('Users', $user_id, ['CaptchaSendNum' => ++$User->CaptchaSendNum], ['User_id' => $user_id]); |
||||
| 283 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'Captcha','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 284 | } else { |
||||
| 285 | $send_return = Send::sendMessage(Get::$chat_id, $msg, 'HTML'); |
||||
| 286 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'Welcome','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 287 | } |
||||
| 288 | } elseif ($Group->Settings->CaptchaStatus->Value && !$User->CaptchaStatus) { |
||||
| 289 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->CaptchaMSG->MSG, 'HTML'); |
||||
| 290 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'Captcha','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 291 | } |
||||
| 292 | } elseif (!Get::$new_chat_member_id && !Get::$left_chat_member_id && strpos(Get::$callback_query_data ?? 'Null', '/captchaVerify_') === false) { |
||||
| 293 | if ($Group->Settings->CaptchaStatus->Value && !$User->CaptchaStatus) { |
||||
| 294 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 295 | if ($User->CaptchaSendNum <= 3) { |
||||
| 296 | $markup = Send::InlineKeyboardMarkup([ |
||||
| 297 | [ |
||||
| 298 | ['text' => 'من ربات نیستم', 'callback_data' => "/captchaVerify_$user_id"] |
||||
| 299 | ] |
||||
| 300 | ]); |
||||
| 301 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->CaptchaMSG->MSG, 'HTML', false, false, null, $markup); |
||||
| 302 | $DB->UpdateData('Users', $user_id, ['CaptchaSendNum' => ++$User->CaptchaSendNum], ['User_id' => $user_id]); |
||||
| 303 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'Captcha','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 304 | } else { |
||||
| 305 | $DB->InsertData('Users/BlackDir', 'ClintBotList', ['User_id' => $user_id, 'Time' => time()]); |
||||
| 306 | Chat::kickChatMember(Get::$chat_id, $user_id); |
||||
| 307 | } |
||||
| 308 | die(); |
||||
| 309 | } elseif ($Group->Settings->ForceTOAddInGP->Value && $Group->AddNumber > $Member->AddNumber) { |
||||
| 310 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 311 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->ForceADDMSG->MSG, 'HTML'); |
||||
| 312 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'ForceTOAddInGP','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 313 | die(); |
||||
| 314 | } elseif ($Group->Settings->DelLinkStatus->Value && in_array('url', array_column(Get::$entities, 'type'))) { |
||||
| 315 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 316 | die(); |
||||
| 317 | } 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))) { |
||||
| 318 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 319 | die(); |
||||
| 320 | } elseif ($Group->Settings->DelMentionStatus->Value && in_array('mention', array_column(Get::$entities, 'type'))) { |
||||
| 321 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 322 | die(); |
||||
| 323 | } elseif ($Group->Settings->DelForwardStatus->Value && Get::$forward_from_chat_type == 'channel' && !in_array(Get::$forward_from_chat_username, $Group->WhiteListChannels)) { |
||||
| 324 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 325 | die(); |
||||
| 326 | } elseif ($Group->Settings->ForceTOChannelJoin->Value) { |
||||
| 327 | $Channels="\n\n"; |
||||
| 328 | $NotJoin = false; |
||||
| 329 | foreach ($Group->GPChannels as $Channel) { |
||||
| 330 | $res = Chat::getChatMember('@'.$Channel, $user_id); |
||||
| 331 | if ($res->ok) { |
||||
| 332 | if ($res->result->status == 'left' || $res->result->status == 'kicked') { |
||||
| 333 | $NotJoin = true; |
||||
| 334 | $Channels .="@".$Channel."\n"; |
||||
| 335 | } |
||||
| 336 | } |
||||
| 337 | } |
||||
| 338 | if ($NotJoin) { |
||||
| 339 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 340 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->ForceChannelJoinMSG->MSG.$Channels, 'HTML'); |
||||
| 341 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'ForceTOChannelJoin','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 342 | } |
||||
| 343 | } |
||||
| 344 | if ($Group->Settings->DelFilterWordsStatus->Value) { |
||||
| 345 | foreach ($Group->WordsFilterList as $word) { |
||||
| 346 | if (preg_match("~$word~i", Get::$text)) { |
||||
| 347 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 348 | die(); |
||||
| 349 | } |
||||
| 350 | } |
||||
| 351 | } |
||||
| 352 | if ($Group->Settings->SpamReportStatus->Value || $Group->Settings->WarnInSpam->Value) { |
||||
| 353 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', $user_id, ['SpamCount' => ++$Member->SpamCount], ['User_id' => $user_id]); |
||||
| 354 | if ($Member->SpamCount >= $Group->SpamNumberToReport && ($Member->SSCU + $Group->SpamTimeToReport) > time()) { |
||||
| 355 | if ($Group->Settings->WarnInSpam->Value) { |
||||
| 356 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', $user_id, ['WarnCount' => ++$Member->WarnCount], ['User_id' => $user_id]); |
||||
| 357 | if ($Member->WarnCount > $Group->WarnNumberToRemove) { |
||||
| 358 | Chat::kickChatMember(Get::$chat_id, $user_id); |
||||
| 359 | } |
||||
| 360 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->BotWarnMSG->MSG, 'HTML'); |
||||
| 361 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'Warn','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 362 | } |
||||
| 363 | if ($Group->Settings->SpamReportStatus->Value) { |
||||
| 364 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->SpamReportMSG->MSG, 'HTML'); |
||||
| 365 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'Report','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 366 | } |
||||
| 367 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', $user_id, ['SpamCount' => 0,'SSCU' => time()], ['User_id' => $user_id]); |
||||
| 368 | $res = Chat::restrictChatMember(Get::$chat_id, $user_id, ['can_send_messages' => false], time()+5*60); |
||||
| 369 | die(); |
||||
| 370 | } elseif (($Member->SSCU + $Group->SpamTimeToReport) < time()) { |
||||
| 371 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', $user_id, ['SpamCount' => 0,'SSCU' => time()], ['User_id' => $user_id]); |
||||
| 372 | } |
||||
| 373 | } |
||||
| 374 | } |
||||
| 375 | } elseif (!in_array($user_id, $Group->WhiteListUsers)) { |
||||
| 376 | if (Get::$reply_to_from_id) { |
||||
| 377 | if (in_array($user_id, $sudors) && Get::$text == '!ثبت کریتور') { |
||||
| 378 | $Group->Creator = Get::$reply_to_from_id; |
||||
| 379 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Settings' => $Group->Settings], ['Chat_id' => Get::$chat_id]); |
||||
| 380 | Send::sendMessage(Get::$chat_id, 'کریتور با موفقیت ثبت شد', null, false, false, Get::$message_id); |
||||
| 381 | } elseif (in_array($user_id, $sudors) && Get::$text == '!افزودن به لیست سیاه') { |
||||
| 382 | if (Get::$reply_to_from_id != ($id = explode(':', getenv('TOKEN'))[0]) && !in_array(Get::$reply_to_from_id, $sudors)) { |
||||
| 383 | $InBlackList = $DB->SelectData('Users/BlackDir', 'BlackList', ['User_id' => Get::$reply_to_from_id]); |
||||
| 384 | if (!$InBlackList) { |
||||
| 385 | $res = Chat::kickChatMember(Get::$chat_id, Get::$reply_to_from_id); |
||||
| 386 | $DB->InsertData('Users/BlackDir', 'BlackList', ['User_id' => Get::$reply_to_from_id, 'Time' => time()]); |
||||
| 387 | if ($res->ok) { |
||||
| 388 | Send::sendMessage(Get::$chat_id, 'کاربر به لیست سیاه اضافه و از گروه ریمو شد', null, false, false, Get::$message_id); |
||||
| 389 | } else { |
||||
| 390 | Send::sendMessage(Get::$chat_id, 'کاربر به لیست سیاه اضافه شد اما به علت :'.PHP_EOL.$res->description.PHP_EOL.'از گروه ریمو نشد', null, false, false, Get::$message_id); |
||||
| 391 | } |
||||
| 392 | } else { |
||||
| 393 | Send::sendMessage(Get::$chat_id, 'کاربر از قبل در لیست سیاه وجود داشت', null, false, false, Get::$message_id); |
||||
| 394 | } |
||||
| 395 | } else { |
||||
| 396 | Send::sendMessage(Get::$chat_id, 'امکان مسدود سازی ادمین وجود ندارد!', null, false, false, Get::$message_id); |
||||
| 397 | } |
||||
| 398 | } elseif (in_array($user_id, $sudors) && Get::$text == '!حذف از لیست سیاه') { |
||||
| 399 | $DB->DeleteData('Users/BlackDir', 'BlackList', ['User_id' => Get::$reply_to_from_id]); |
||||
| 400 | Send::sendMessage(Get::$chat_id, 'کاربر از لیست سیاه حذف شد', null, false, false, Get::$message_id); |
||||
| 401 | } elseif ((in_array($user_id, $sudors) || $user_id == $Group->Creator) && Get::$text == '!ثبت ادمین') { |
||||
| 402 | if (!in_array(Get::$reply_to_from_id, $Group->Administrators)) { |
||||
| 403 | $Group->Administrators[] = Get::$reply_to_from_id; |
||||
| 404 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Administrators' => $Group->Administrators], ['Chat_id' => Get::$chat_id]); |
||||
| 405 | Send::sendMessage(Get::$chat_id, 'ادمین با موفقیت ثبت شد', null, false, false, Get::$message_id); |
||||
| 406 | } else { |
||||
| 407 | Send::sendMessage(Get::$chat_id, 'ادمین از قبل وجود داشت', null, false, false, Get::$message_id); |
||||
| 408 | } |
||||
| 409 | } elseif ((in_array($user_id, $sudors) || $user_id == $Group->Creator) && Get::$text == '!حذف ادمین') { |
||||
| 410 | $new_admins = []; |
||||
| 411 | foreach ($Group->Administrators as $admin) { |
||||
| 412 | if ($admin != Get::$reply_to_from_id) { |
||||
| 413 | $new_admins[] = $admin; |
||||
| 414 | } |
||||
| 415 | } |
||||
| 416 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Administrators' => $new_admins], ['Chat_id' => Get::$chat_id]); |
||||
| 417 | Send::sendMessage(Get::$chat_id, 'ادمین با موفقیت حذف شد', null, false, false, Get::$message_id); |
||||
| 418 | } elseif (Get::$text == '!اخطار') { |
||||
| 419 | 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)) { |
||||
| 420 | $Member = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', Get::$reply_to_from_id, ['User_id' => Get::$reply_to_from_id]); |
||||
| 421 | $Member->WarnCount = $Member->WarnCount +1; |
||||
| 422 | $text = $Group->MSGs->WarnMSG->MSG; |
||||
| 423 | if (strpos($text, '-MENTION')) { |
||||
| 424 | $text = preg_replace('/-MENTION=(~.*?~)(.*?)-/', "<a href='tg://user?id=$1'>$2</a>", $text); |
||||
| 425 | } |
||||
| 426 | if (strpos($text, '~USER_ID~')) { |
||||
| 427 | $text = str_replace('~USER_ID~', Get::$from_id, $text); |
||||
| 428 | } |
||||
| 429 | if (strpos($text, '~FIRST_NAME~')) { |
||||
| 430 | $text = str_replace('~FIRST_NAME~', Get::$from_first_name, $text); |
||||
| 431 | } |
||||
| 432 | if (strpos($text, '~LAST_NAME~')) { |
||||
| 433 | $text = str_replace('~LAST_NAME~', Get::$from_last_name, $text); |
||||
| 434 | } |
||||
| 435 | if (strpos($text, '~USERNAME~')) { |
||||
| 436 | $text = str_replace('~USERNAME~', Get::$from_username, $text); |
||||
| 437 | } |
||||
| 438 | // |
||||
| 439 | if (strpos($text, '~GROUP_ID~')) { |
||||
| 440 | $text = str_replace('~GROUP_ID~', '@' . Get::$chat_id, $text); |
||||
| 441 | } |
||||
| 442 | if (strpos($text, '~GROUP_TITLE~')) { |
||||
| 443 | $text = str_replace('~GROUP_TITLE~', Get::$chat_title, $text); |
||||
| 444 | } |
||||
| 445 | if (strpos($text, '~GROUP_USERNAME~')) { |
||||
| 446 | $text = str_replace('~GROUP_USERNAME~', '@' . Get::$chat_username, $text); |
||||
| 447 | } |
||||
| 448 | // |
||||
| 449 | if (strpos($text, '~NEW_USER_ID~')) { |
||||
| 450 | $text = str_replace('~NEW_USER_ID~', Get::$new_chat_member_id, $text); |
||||
| 451 | } |
||||
| 452 | if (strpos($text, '~NEW_FIRST_NAME~')) { |
||||
| 453 | $text = str_replace('~NEW_FIRST_NAME~', Get::$new_chat_member_first_name, $text); |
||||
| 454 | } |
||||
| 455 | if (strpos($text, '~NEW_LAST_NAME~')) { |
||||
| 456 | $text = str_replace('~NEW_LAST_NAME~', Get::$new_chat_member_last_name, $text); |
||||
| 457 | } |
||||
| 458 | if (strpos($text, '~NEW_USERNAME~')) { |
||||
| 459 | $text = str_replace('~NEW_USERNAME~', Get::$new_chat_member_username, $text); |
||||
| 460 | } |
||||
| 461 | // |
||||
| 462 | if (strpos($text, '~IN_REPLY_ID~')) { |
||||
| 463 | $text = str_replace('~IN_REPLY_ID~', Get::$reply_to_from_id, $text); |
||||
| 464 | } |
||||
| 465 | if (strpos($text, '~IN_REPLY_FIRST_NAME~')) { |
||||
| 466 | $text = str_replace('~IN_REPLY_FIRST_NAME~', Get::$reply_to_from_first_name, $text); |
||||
| 467 | } |
||||
| 468 | if (strpos($text, '~IN_REPLY_LAST_NAME~')) { |
||||
| 469 | $text = str_replace('~IN_REPLY_LAST_NAME~', Get::$reply_to_from_last_name, $text); |
||||
| 470 | } |
||||
| 471 | if (strpos($text, '~IN_REPLY_USERNAME~')) { |
||||
| 472 | $text = str_replace('~IN_REPLY_USERNAME~', Get::$reply_to_from_username, $text); |
||||
| 473 | } |
||||
| 474 | // |
||||
| 475 | if (strpos($text, '~ENTER~')) { |
||||
| 476 | $text = str_replace('~ENTER~', "\n", $text); |
||||
| 477 | } |
||||
| 478 | if (strpos($text, '~CREATOR_ID~')) { |
||||
| 479 | $text = str_replace('~CREATOR_ID~', $Group->Creator, $text); |
||||
| 480 | } |
||||
| 481 | if (strpos($text, '~GP_CHANNEL~')) { |
||||
| 482 | $text = str_replace('~GP_CHANNEL~', $Group->Creator, $text); |
||||
| 483 | } |
||||
| 484 | if (strpos($text, '~CAPTCHASENDNUM~')) { |
||||
| 485 | $text = str_replace('~CAPTCHASENDNUM~', $User->CaptchaSendNum, $text); |
||||
| 486 | } |
||||
| 487 | if (strpos($text, '~USERWARNCOUNT~')) { |
||||
| 488 | $text = str_replace('~USERWARNCOUNT~', $Member->WarnCount, $text); |
||||
| 489 | } |
||||
| 490 | if (strpos($text, '~WARNNUMBERTOREMOVE~')) { |
||||
| 491 | $text = str_replace('~WARNNUMBERTOREMOVE~', $Group->WarnNumberToRemove, $text); |
||||
| 492 | } |
||||
| 493 | if (strpos($text, '~ADD_NUMBER~')) { |
||||
| 494 | $text = str_replace('~ADD_NUMBER~', $Member->AddNumber, $text); |
||||
| 495 | } |
||||
| 496 | if (strpos($text, '~SHOULD_ADD_NUMBER~')) { |
||||
| 497 | $text = str_replace('~SHOULD_ADD_NUMBER~', $Group->AddNumber, $text); |
||||
| 498 | } |
||||
| 499 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', Get::$reply_to_from_id, ['WarnCount' => $Member->WarnCount], ['User_id' => Get::$reply_to_from_id]); |
||||
| 500 | if ($Member->WarnCount > $Group->WarnNumberToRemove) { |
||||
| 501 | Chat::kickChatMember(Get::$chat_id, Get::$reply_to_from_id); |
||||
| 502 | } |
||||
| 503 | $send_return = Send::sendMessage(Get::$chat_id, $text, 'HTML'); |
||||
| 504 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'Warn','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 505 | } else { |
||||
| 506 | Send::sendMessage(Get::$chat_id, 'امکان محدود سازی ادمین وجود ندارد!', null, false, false, Get::$message_id); |
||||
| 507 | } |
||||
| 508 | } elseif (Get::$text == '!حذف اخطار') { |
||||
| 509 | $Member = $DB->SelectData('Groups/' . Get::$chat_id . '/Users', Get::$reply_to_from_id, ['User_id' => Get::$reply_to_from_id]); |
||||
| 510 | $Member->WarnCount = $Member->WarnCount -1; |
||||
| 511 | $text = $Group->MSGs->WarnMSG->MSG; |
||||
| 512 | if (strpos($text, '-MENTION')) { |
||||
| 513 | $text = preg_replace('/-MENTION=(~.*?~)(.*?)-/', "<a href='tg://user?id=$1'>$2</a>", $text); |
||||
| 514 | } |
||||
| 515 | if (strpos($text, '~USER_ID~')) { |
||||
| 516 | $text = str_replace('~USER_ID~', Get::$from_id, $text); |
||||
| 517 | } |
||||
| 518 | if (strpos($text, '~FIRST_NAME~')) { |
||||
| 519 | $text = str_replace('~FIRST_NAME~', Get::$from_first_name, $text); |
||||
| 520 | } |
||||
| 521 | if (strpos($text, '~LAST_NAME~')) { |
||||
| 522 | $text = str_replace('~LAST_NAME~', Get::$from_last_name, $text); |
||||
| 523 | } |
||||
| 524 | if (strpos($text, '~USERNAME~')) { |
||||
| 525 | $text = str_replace('~USERNAME~', Get::$from_username, $text); |
||||
| 526 | } |
||||
| 527 | // |
||||
| 528 | if (strpos($text, '~GROUP_ID~')) { |
||||
| 529 | $text = str_replace('~GROUP_ID~', '@' . Get::$chat_id, $text); |
||||
| 530 | } |
||||
| 531 | if (strpos($text, '~GROUP_TITLE~')) { |
||||
| 532 | $text = str_replace('~GROUP_TITLE~', Get::$chat_title, $text); |
||||
| 533 | } |
||||
| 534 | if (strpos($text, '~GROUP_USERNAME~')) { |
||||
| 535 | $text = str_replace('~GROUP_USERNAME~', '@' . Get::$chat_username, $text); |
||||
| 536 | } |
||||
| 537 | // |
||||
| 538 | if (strpos($text, '~NEW_USER_ID~')) { |
||||
| 539 | $text = str_replace('~NEW_USER_ID~', Get::$new_chat_member_id, $text); |
||||
| 540 | } |
||||
| 541 | if (strpos($text, '~NEW_FIRST_NAME~')) { |
||||
| 542 | $text = str_replace('~NEW_FIRST_NAME~', Get::$new_chat_member_first_name, $text); |
||||
| 543 | } |
||||
| 544 | if (strpos($text, '~NEW_LAST_NAME~')) { |
||||
| 545 | $text = str_replace('~NEW_LAST_NAME~', Get::$new_chat_member_last_name, $text); |
||||
| 546 | } |
||||
| 547 | if (strpos($text, '~NEW_USERNAME~')) { |
||||
| 548 | $text = str_replace('~NEW_USERNAME~', Get::$new_chat_member_username, $text); |
||||
| 549 | } |
||||
| 550 | // |
||||
| 551 | if (strpos($text, '~IN_REPLY_ID~')) { |
||||
| 552 | $text = str_replace('~IN_REPLY_ID~', Get::$reply_to_from_id, $text); |
||||
| 553 | } |
||||
| 554 | if (strpos($text, '~IN_REPLY_FIRST_NAME~')) { |
||||
| 555 | $text = str_replace('~IN_REPLY_FIRST_NAME~', Get::$reply_to_from_first_name, $text); |
||||
| 556 | } |
||||
| 557 | if (strpos($text, '~IN_REPLY_LAST_NAME~')) { |
||||
| 558 | $text = str_replace('~IN_REPLY_LAST_NAME~', Get::$reply_to_from_last_name, $text); |
||||
| 559 | } |
||||
| 560 | if (strpos($text, '~IN_REPLY_USERNAME~')) { |
||||
| 561 | $text = str_replace('~IN_REPLY_USERNAME~', Get::$reply_to_from_username, $text); |
||||
| 562 | } |
||||
| 563 | // |
||||
| 564 | if (strpos($text, '~ENTER~')) { |
||||
| 565 | $text = str_replace('~ENTER~', "\n", $text); |
||||
| 566 | } |
||||
| 567 | if (strpos($text, '~CREATOR_ID~')) { |
||||
| 568 | $text = str_replace('~CREATOR_ID~', $Group->Creator, $text); |
||||
| 569 | } |
||||
| 570 | if (strpos($text, '~GP_CHANNEL~')) { |
||||
| 571 | $text = str_replace('~GP_CHANNEL~', $Group->Creator, $text); |
||||
| 572 | } |
||||
| 573 | if (strpos($text, '~CAPTCHASENDNUM~')) { |
||||
| 574 | $text = str_replace('~CAPTCHASENDNUM~', $User->CaptchaSendNum, $text); |
||||
| 575 | } |
||||
| 576 | if (strpos($text, '~USERWARNCOUNT~')) { |
||||
| 577 | $text = str_replace('~USERWARNCOUNT~', $Member->WarnCount, $text); |
||||
| 578 | } |
||||
| 579 | if (strpos($text, '~WARNNUMBERTOREMOVE~')) { |
||||
| 580 | $text = str_replace('~WARNNUMBERTOREMOVE~', $Group->WarnNumberToRemove, $text); |
||||
| 581 | } |
||||
| 582 | if (strpos($text, '~ADD_NUMBER~')) { |
||||
| 583 | $text = str_replace('~ADD_NUMBER~', $Member->AddNumber, $text); |
||||
| 584 | } |
||||
| 585 | if (strpos($text, '~SHOULD_ADD_NUMBER~')) { |
||||
| 586 | $text = str_replace('~SHOULD_ADD_NUMBER~', $Group->AddNumber, $text); |
||||
| 587 | } |
||||
| 588 | $DB->UpdateData('Groups/' . Get::$chat_id . '/Users', Get::$reply_to_from_id, ['WarnCount' => $Member->WarnCount], ['User_id' => Get::$reply_to_from_id]); |
||||
| 589 | $send_return = Send::sendMessage(Get::$chat_id, $Group->MSGs->delWarnMSG->MSG, 'HTML'); |
||||
| 590 | $DB->InsertData('Bot', 'Temp', ['id'=>rand(),'Type'=>'Warn','Time' => time(),'Message_id' => $send_return->result->message_id,'Chat_id' => Get::$chat_id]); |
||||
| 591 | } elseif (Get::$text == '!افزودن به لیست سفید') { |
||||
| 592 | if (!in_array(Get::$reply_to_from_id, $Group->WhiteListUsers)) { |
||||
| 593 | $Group->WhiteListUsers[] = Get::$reply_to_from_id; |
||||
| 594 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $Group->WhiteListUsers], ['Chat_id' => Get::$chat_id]); |
||||
| 595 | Send::sendMessage(Get::$chat_id, 'کاربر با موفقیت به لیست سفید اضافه شد', null, false, false, Get::$message_id); |
||||
| 596 | } else { |
||||
| 597 | Send::sendMessage(Get::$chat_id, 'کاربر از قبل در لیست وجود داشت', null, false, false, Get::$message_id); |
||||
| 598 | } |
||||
| 599 | } elseif (Get::$text == '!حذف از لیست سفید') { |
||||
| 600 | $new_list = []; |
||||
| 601 | foreach ($Group->WhiteListUsers as $WhiteListUser) { |
||||
| 602 | if ($WhiteListUser != Get::$reply_to_from_id) { |
||||
| 603 | $new_list[] = $WhiteListUser; |
||||
| 604 | } |
||||
| 605 | } |
||||
| 606 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
| 607 | Send::sendMessage(Get::$chat_id, 'کاربر از لیست سفید حذف شد', null, false, false, Get::$message_id); |
||||
| 608 | } elseif (Get::$text == '!ریمو') { |
||||
| 609 | if (Get::$reply_to_from_id != ($id = explode(':', getenv('TOKEN'))[0]) && !in_array(Get::$reply_to_from_id, $sudors)) { |
||||
| 610 | $res = Chat::kickChatMember(Get::$chat_id, Get::$reply_to_from_id); |
||||
| 611 | if ($res->ok) { |
||||
| 612 | Send::sendMessage(Get::$chat_id, 'کاربر ریمو شد', null, false, false, Get::$message_id); |
||||
| 613 | } else { |
||||
| 614 | Send::sendMessage(Get::$chat_id, 'کاربر به علت :'.PHP_EOL.$res->description.PHP_EOL.'ریمو نشد', null, false, false, Get::$message_id); |
||||
| 615 | } |
||||
| 616 | } else { |
||||
| 617 | Send::sendMessage(Get::$chat_id, 'امکان ریمو کردن ادمین وجود ندارد!', null, false, false, Get::$message_id); |
||||
| 618 | } |
||||
| 619 | } elseif (preg_match('~^!سکوت ([0-9]*)$~', Get::$text, $match)) { |
||||
| 620 | if (Get::$reply_to_from_id != ($id = explode(':', getenv('TOKEN'))[0]) && !in_array(Get::$reply_to_from_id, $sudors)) { |
||||
| 621 | $res = Chat::restrictChatMember(Get::$chat_id, Get::$reply_to_from_id, ['can_send_messages' => false], $match[1]*60); |
||||
| 622 | if ($res->ok) { |
||||
| 623 | Send::sendMessage(Get::$chat_id, 'کاربر به مدت ' . $match[1] . ' دقیقه محدود شد', null, false, false, Get::$message_id); |
||||
| 624 | } else { |
||||
| 625 | Send::sendMessage(Get::$chat_id, 'کاربر به علت :'.PHP_EOL.$res->description.PHP_EOL.'محدود نشد', null, false, false, Get::$message_id); |
||||
| 626 | } |
||||
| 627 | } else { |
||||
| 628 | Send::sendMessage(Get::$chat_id, 'امکان محدود سازی ادمین وجود ندارد!', null, false, false, Get::$message_id); |
||||
| 629 | } |
||||
| 630 | } |
||||
| 631 | } else { |
||||
| 632 | if ((in_array($user_id, $sudors) || $user_id == $Group->Creator) && Get::$text == '!لیست ادمین ها') { |
||||
| 633 | $msg = 'لیست ادمین های گروه'; |
||||
| 634 | foreach ($Group->Administrators as $admin) { |
||||
| 635 | $msg .= PHP_EOL."<a href='tg://user?id=$admin'>$admin</a>"; |
||||
| 636 | } |
||||
| 637 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
| 638 | } elseif (Get::$text == '!لیست سفید') { |
||||
| 639 | $msg = '<strong>'.'لیست سفید کاربران'.' : </strong>'; |
||||
| 640 | foreach ($Group->WhiteListUsers as $WhiteListUser) { |
||||
| 641 | $msg .= PHP_EOL."<a href='tg://user?id=$WhiteListUser'>$WhiteListUser</a>"; |
||||
| 642 | } |
||||
| 643 | $msg .= PHP_EOL.PHP_EOL.'<strong>'.'لیست سفید کانال ها'.' : </strong>'; |
||||
| 644 | foreach ($Group->WhiteListChannels as $WhiteListChannel) { |
||||
| 645 | $msg .= PHP_EOL.'@'.$WhiteListChannel; |
||||
| 646 | } |
||||
| 647 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
| 648 | } elseif (Get::$text == '!قفل کردن گروه') { |
||||
| 649 | Send::sendMessage(Get::$chat_id, 'گروه قفل شد', 'HTML', false, false, null); |
||||
| 650 | $permission = [ |
||||
| 651 | 'can_send_messages' => false, |
||||
| 652 | ]; |
||||
| 653 | Chat::setChatPermissions(Get::$chat_id, $permission); |
||||
| 654 | } elseif (Get::$text == '!باز کردن گروه') { |
||||
| 655 | Send::sendMessage(Get::$chat_id, 'گروه باز شد', 'HTML', false, false, null); |
||||
| 656 | $permission = [ |
||||
| 657 | 'can_send_polls' => true, |
||||
| 658 | 'can_send_other_messages' => true, |
||||
| 659 | 'can_add_web_page_previews' => true, |
||||
| 660 | 'can_invite_users' => true, |
||||
| 661 | ]; |
||||
| 662 | Chat::setChatPermissions(Get::$chat_id, $permission); |
||||
| 663 | } elseif (Get::$text == '!تنظیمات'|| strpos(Get::$callback_query_data ?? 'Null', '/disableProperty_') !== false || strpos(Get::$callback_query_data ?? 'Null', '/enableProperty_') !== false) { |
||||
| 664 | if (strpos(Get::$callback_query_data ?? 'Null', '/disableProperty_') !== false) { |
||||
| 665 | $Property = str_replace('/disableProperty_', '', Get::$callback_query_data); |
||||
| 666 | $Group->Settings->$Property->Value = false; |
||||
| 667 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Settings' => $Group->Settings], ['Chat_id' => Get::$chat_id]); |
||||
| 668 | } elseif (strpos(Get::$callback_query_data ?? 'Null', '/enableProperty_') !== false) { |
||||
| 669 | $Property = str_replace('/enableProperty_', '', Get::$callback_query_data); |
||||
| 670 | $Group->Settings->$Property->Value = true; |
||||
| 671 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['Settings' => $Group->Settings], ['Chat_id' => Get::$chat_id]); |
||||
| 672 | } |
||||
| 673 | $keys = [[]]; |
||||
| 674 | foreach ($Group->Settings as $key => $value) { |
||||
| 675 | if ($value->Value) { |
||||
| 676 | $keys[][] = ['text' => $value->name . ' - ✅', 'callback_data' => '/disableProperty_' . $key]; |
||||
| 677 | } else { |
||||
| 678 | $keys[][] = ['text' => $value->name . ' - ❌', 'callback_data' => '/enableProperty_' . $key]; |
||||
| 679 | } |
||||
| 680 | } |
||||
| 681 | $markup = Send::InlineKeyboardMarkup($keys); |
||||
| 682 | |||||
| 683 | if (strpos(Get::$callback_query_data ?? 'Null', '/disableProperty_') !== false || strpos(Get::$callback_query_data ?? 'Null', '/enableProperty_') !== false) { |
||||
| 684 | 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
Loading history...
|
|||||
| 685 | } else { |
||||
| 686 | Send::sendMessage(Get::$chat_id, 'لطفا برای فعال سازی یا غیر فعال سازی کلیک کنید', 'HTML', false, false, null, $markup); |
||||
| 687 | } |
||||
| 688 | } elseif (Get::$text == '!راهنما') { |
||||
| 689 | $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~"; |
||||
| 690 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
| 691 | } elseif (Get::$text == '!لیست پیام ها') { |
||||
| 692 | $msg = 'پیام ها :'; |
||||
| 693 | foreach ($Group->MSGs as $MSG) { |
||||
| 694 | $msg .= PHP_EOL.PHP_EOL.'<strong>'.$MSG->name.' : </strong>'.PHP_EOL.$MSG->MSG; |
||||
| 695 | } |
||||
| 696 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
| 697 | } elseif (Get::$text == '!لیست کانال ها') { |
||||
| 698 | $msg = 'کانال ها :'; |
||||
| 699 | foreach ($Group->GPChannels as $GPChannel) { |
||||
| 700 | $msg .= PHP_EOL.'@'.$GPChannel; |
||||
| 701 | } |
||||
| 702 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
| 703 | } elseif (Get::$text == '!لیست فیلتر') { |
||||
| 704 | $msg = 'کلمات فیلتر شده :'; |
||||
| 705 | foreach ($Group->WordsFilterList as $Words) { |
||||
| 706 | $msg .= PHP_EOL.$Words; |
||||
| 707 | } |
||||
| 708 | Send::sendMessage(Get::$chat_id, $msg, 'HTML', false, false, null); |
||||
| 709 | } elseif (preg_match('~^!افزودن به لیست سفید (.*)$~', Get::$text, $match)) { |
||||
| 710 | if (is_int($match[1])) { |
||||
| 711 | if (!in_array($match[1], $Group->WhiteListUsers)) { |
||||
| 712 | $Group->WhiteListUsers[] = $match[1]; |
||||
| 713 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $Group->WhiteListUsers], ['Chat_id' => Get::$chat_id]); |
||||
| 714 | Send::sendMessage(Get::$chat_id, 'کاربر با موفقیت به لیست سفید اضافه شد', null, false, false, Get::$message_id); |
||||
| 715 | } else { |
||||
| 716 | Send::sendMessage(Get::$chat_id, 'کاربر از قبل در لیست وجود داشت!', null, false, false, Get::$message_id); |
||||
| 717 | } |
||||
| 718 | } elseif (substr($match[1], 0, 1) == '@') { |
||||
| 719 | $Channel = trim($match[1], '@'); |
||||
| 720 | if (!in_array($Channel, $Group->WhiteListChannels)) { |
||||
| 721 | $Group->WhiteListChannels[] = $Channel; |
||||
| 722 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListChannels' => $Group->WhiteListChannels], ['Chat_id' => Get::$chat_id]); |
||||
| 723 | Send::sendMessage(Get::$chat_id, 'کانال با موفقیت به لیست سفید اضافه شد', null, false, false, Get::$message_id); |
||||
| 724 | } else { |
||||
| 725 | Send::sendMessage(Get::$chat_id, 'کانال از قبل در لیست وجود داشت!', null, false, false, Get::$message_id); |
||||
| 726 | } |
||||
| 727 | } else { |
||||
| 728 | Send::sendMessage(Get::$chat_id, 'فرمت ارسالی پشتیبانی نمیشود!', null, false, false, Get::$message_id); |
||||
| 729 | } |
||||
| 730 | } elseif (preg_match('~^!حذف از لیست سفید (.*)$~', Get::$text, $match)) { |
||||
| 731 | if (is_int($match[1])) { |
||||
| 732 | $new_list = []; |
||||
| 733 | foreach ($Group->WhiteListUsers as $WhiteListUser) { |
||||
| 734 | if ($WhiteListUser != $match[1]) { |
||||
| 735 | $new_list[] = $WhiteListUser; |
||||
| 736 | } |
||||
| 737 | } |
||||
| 738 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
| 739 | Send::sendMessage(Get::$chat_id, 'کاربر از لیست سفید حذف شد', null, false, false, Get::$message_id); |
||||
| 740 | } elseif (substr($match[1], 0, 1) == '@') { |
||||
| 741 | $new_list = []; |
||||
| 742 | foreach ($Group->WhiteListChannels as $WhiteListChannel) { |
||||
| 743 | if ($WhiteListChannel != trim($match[1], '@')) { |
||||
| 744 | $new_list[] = $WhiteListChannel; |
||||
| 745 | } |
||||
| 746 | } |
||||
| 747 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListChannels' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
| 748 | Send::sendMessage(Get::$chat_id, 'کانال از لیست سفید حذف شد', null, false, false, Get::$message_id); |
||||
| 749 | } else { |
||||
| 750 | Send::sendMessage(Get::$chat_id, 'فرمت ارسال پشتیبانی نمیشود!', null, false, false, Get::$message_id); |
||||
| 751 | } |
||||
| 752 | } elseif (preg_match('~^!افزودن کانال (@.*)$~', Get::$text, $match)) { |
||||
| 753 | $Channel = trim($match[1], '@'); |
||||
| 754 | if (!in_array($Channel, $Group->GPChannels)) { |
||||
| 755 | $Group->GPChannels[] = $Channel; |
||||
| 756 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['GPChannels' => $Group->GPChannels], ['Chat_id' => Get::$chat_id]); |
||||
| 757 | Send::sendMessage(Get::$chat_id, 'کانال با موفقیت به لیست اضافه شد', null, false, false, Get::$message_id); |
||||
| 758 | } else { |
||||
| 759 | Send::sendMessage(Get::$chat_id, 'کانال از قبل در لیست وجود داشت!', null, false, false, Get::$message_id); |
||||
| 760 | } |
||||
| 761 | } elseif (preg_match('~^!حذف کانال (@.*)$~', Get::$text, $match)) { |
||||
| 762 | $new_list = []; |
||||
| 763 | foreach ($Group->GPChannels as $GPChannels) { |
||||
| 764 | if ($GPChannels != trim($match[1], '@')) { |
||||
| 765 | $new_list[] = $GPChannels; |
||||
| 766 | } |
||||
| 767 | } |
||||
| 768 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['GPChannels' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
| 769 | Send::sendMessage(Get::$chat_id, 'کانال از لیست حذف شد', null, false, false, Get::$message_id); |
||||
| 770 | } elseif (preg_match('~^!فیلتر (.*)$~', Get::$text, $match)) { |
||||
| 771 | if (!in_array($match[1], $Group->WordsFilterList)) { |
||||
| 772 | $Group->WordsFilterList[] = $match[1]; |
||||
| 773 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WordsFilterList' => $Group->WordsFilterList], ['Chat_id' => Get::$chat_id]); |
||||
| 774 | Send::sendMessage(Get::$chat_id, 'کلمه با موفقیت به لیست اضافه شد', null, false, false, Get::$message_id); |
||||
| 775 | } else { |
||||
| 776 | Send::sendMessage(Get::$chat_id, 'کلمه از قبل در لیست وجود داشت!', null, false, false, Get::$message_id); |
||||
| 777 | } |
||||
| 778 | } elseif (preg_match('~^!حذف فیلتر (.*)$~', Get::$text, $match)) { |
||||
| 779 | $new_list = []; |
||||
| 780 | foreach ($Group->WordsFilterList as $Word) { |
||||
| 781 | if ($Word != $match[1]) { |
||||
| 782 | $new_list[] = $Word; |
||||
| 783 | } |
||||
| 784 | } |
||||
| 785 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WordsFilterList' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
| 786 | Send::sendMessage(Get::$chat_id, 'کلمه از لیست حذف شد', null, false, false, Get::$message_id); |
||||
| 787 | } elseif (preg_match('~^!تغییر اد ([0-9]*)$~', Get::$text, $match)) { |
||||
| 788 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['AddNumber' => $match[1]], ['Chat_id' => Get::$chat_id]); |
||||
| 789 | Send::sendMessage(Get::$chat_id, 'تعداد اد باموفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 790 | } elseif (preg_match('~^!حذف ادمین ([0-9]*)$~', Get::$text, $match)) { |
||||
| 791 | if (!in_array($match[1], $Group->WhiteListUsers)) { |
||||
| 792 | $Group->WhiteListUsers[] = $match[1]; |
||||
| 793 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $Group->WhiteListUsers], ['Chat_id' => Get::$chat_id]); |
||||
| 794 | Send::sendMessage(Get::$chat_id, 'کاربر با موفقیت به لیست سفید اضافه شد', null, false, false, Get::$message_id); |
||||
| 795 | } else { |
||||
| 796 | Send::sendMessage(Get::$chat_id, 'کاربر از قبل در لیست وجود داشت', null, false, false, Get::$message_id); |
||||
| 797 | } |
||||
| 798 | } elseif (preg_match('~^!ثبت ادمین ([0-9]*)$~', Get::$text, $match)) { |
||||
| 799 | $new_list = []; |
||||
| 800 | foreach ($Group->WhiteListUsers as $WhiteListUser) { |
||||
| 801 | if ($WhiteListUser != $match[1]) { |
||||
| 802 | $new_list[] = $WhiteListUser; |
||||
| 803 | } |
||||
| 804 | } |
||||
| 805 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['WhiteListUsers' => $new_list], ['Chat_id' => Get::$chat_id]); |
||||
| 806 | Send::sendMessage(Get::$chat_id, 'کاربر از لیست سفید حذف شد', null, false, false, Get::$message_id); |
||||
| 807 | } elseif (preg_match('~^!حذف ([0-9]*)$~', Get::$text, $match)) { |
||||
| 808 | if ($match[1] <= 20) { |
||||
| 809 | $end = Get::$message_id - $match[1]; |
||||
| 810 | for ($i = Get::$message_id; $i >= $end; $i--) { |
||||
| 811 | Chat::deleteMessage(Get::$chat_id, $i); |
||||
| 812 | } |
||||
| 813 | } else { |
||||
| 814 | Send::sendMessage(Get::$chat_id, 'در حال حاظر محدودیت 20 عددی وجود دارد.'); |
||||
| 815 | } |
||||
| 816 | } elseif (preg_match('~^!تغییر پیام خوش آمدگویی (.*)~', Get::$text, $match)) { |
||||
| 817 | $Group->MSGs->WelcomeMSG->MSG = $match[1]; |
||||
| 818 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
| 819 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 820 | } elseif (preg_match('~^!تغییر پیام کپچا (.*)~', Get::$text, $match)) { |
||||
| 821 | $Group->MSGs->CaptchaMSG->MSG = $match[1]; |
||||
| 822 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
| 823 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 824 | } elseif (preg_match('~^!تغییر پیام عضویت اجباری (.*)~', Get::$text, $match)) { |
||||
| 825 | $Group->MSGs->ForceChannelJoinMSG->MSG = $match[1]; |
||||
| 826 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
| 827 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 828 | } elseif (preg_match('~^!تغییر پیام اد اجباری (.*)~', Get::$text, $match)) { |
||||
| 829 | $Group->MSGs->ForceADDMSG->MSG = $match[1]; |
||||
| 830 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
| 831 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 832 | } elseif (preg_match('~^!تغییر پیام گذارش اسپم (.*)~', Get::$text, $match)) { |
||||
| 833 | $Group->MSGs->SpamReportMSG->MSG = $match[1]; |
||||
| 834 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
| 835 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 836 | } elseif (preg_match('~^!تغییر پیام اخطار (.*)~', Get::$text, $match)) { |
||||
| 837 | $Group->MSGs->WarnMSG->MSG = $match[1]; |
||||
| 838 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
| 839 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 840 | } elseif (preg_match('~^!تغییر پیام اخطار اسپم (.*)~', Get::$text, $match)) { |
||||
| 841 | $Group->MSGs->BotWarnMSG->MSG = $match[1]; |
||||
| 842 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
| 843 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 844 | } elseif (preg_match('~^!تغییر پیام حذف اخطار (.*)~', Get::$text, $match)) { |
||||
| 845 | $Group->MSGs->delWarnMSG->MSG = $match[1]; |
||||
| 846 | $DB->UpdateData('Groups/' . Get::$chat_id, Get::$chat_id, ['MSGs' => $Group->MSGs], ['Chat_id' => Get::$chat_id]); |
||||
| 847 | Send::sendMessage(Get::$chat_id, 'پیام با موفقیت تغییر کرد', null, false, false, Get::$message_id); |
||||
| 848 | } |
||||
| 849 | } |
||||
| 850 | } |
||||
| 851 | $DB->UpdateData('Users/', $user_id, ['MSGCount' => ++$User->MSGCount], ['User_id' => $user_id]); |
||||
| 852 | if (Get::$reply_to_from_id) { |
||||
| 853 | if (preg_match('~ممنون|مرسی|شکر|دمت~', Get::$text)) { |
||||
| 854 | if ($User->LTU + 60*10 < time() && Get::$reply_to_from_id != Get::$from_id) { |
||||
| 855 | $User = $DB->SelectData('Users', Get::$reply_to_from_id, ['User_id' => Get::$reply_to_from_id]); |
||||
| 856 | $DB->UpdateData('Users/', Get::$reply_to_from_id, ['ThankCount' => ++$User->ThankCount], ['User_id' => Get::$reply_to_from_id]); |
||||
| 857 | } |
||||
| 858 | } elseif ((Get::$text == 'فارسی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 859 | $msg = GoogleTranslate::translate('auto', 'fa', $text); |
||||
| 860 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 861 | } elseif ((Get::$text == 'انگلیسی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 862 | $msg = GoogleTranslate::translate('auto', 'en', $text); |
||||
| 863 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 864 | } elseif ((Get::$text == 'ایتالیایی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 865 | $msg = GoogleTranslate::translate('auto', 'it', $text); |
||||
| 866 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 867 | } elseif ((Get::$text == 'فرانسوی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 868 | $msg = GoogleTranslate::translate('auto', 'fr', $text); |
||||
| 869 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 870 | } elseif ((Get::$text == 'آلمانی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 871 | $msg = GoogleTranslate::translate('auto', 'de', $text); |
||||
| 872 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 873 | } elseif ((Get::$text == 'ترکی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 874 | $msg = GoogleTranslate::translate('auto', 'tr', $text); |
||||
| 875 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 876 | } elseif ((Get::$text == 'عربی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 877 | $msg = GoogleTranslate::translate('auto', 'ar', $text); |
||||
| 878 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 879 | } elseif ((Get::$text == 'ژاپنی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 880 | $msg = GoogleTranslate::translate('auto', 'ja', $text); |
||||
| 881 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 882 | } elseif ((Get::$text == 'چینی') && ($text = Get::$reply_to_text ?? Get::$reply_to_caption) && isset($text)) { |
||||
| 883 | $msg = GoogleTranslate::translate('auto', 'zh', $text); |
||||
| 884 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 885 | } |
||||
| 886 | } else { |
||||
| 887 | if ($Group->Settings->InfoMSGStatus->Value && (preg_match('~^(me|من|اینفو|info)$~i', Get::$text))) { |
||||
| 888 | $UserInfo = Get::getUserProfilePhotos(Get::$from_id); |
||||
| 889 | if ($UserInfo->ok) { |
||||
| 890 | if ($Member->ThankCount > 1000) { |
||||
| 891 | $Position = '⭐⭐⭐⭐⭐'; |
||||
| 892 | } elseif ($Member->ThankCount > 500) { |
||||
| 893 | $Position = '⭐⭐⭐⭐'; |
||||
| 894 | } elseif ($Member->ThankCount > 200) { |
||||
| 895 | $Position = '⭐⭐⭐'; |
||||
| 896 | } elseif ($Member->ThankCount > 100) { |
||||
| 897 | $Position = '⭐⭐'; |
||||
| 898 | } elseif ($Member->ThankCount < 10) { |
||||
| 899 | $Position = '⭐'; |
||||
| 900 | } |
||||
| 901 | $photo = end($UserInfo->result->photos[0])->file_id; |
||||
| 902 | $msg = 'نام : '.Get::$from_first_name.' '.Get::$from_last_name; |
||||
| 903 | if (Get::$from_username) { |
||||
| 904 | $msg .="\n\n نام کاربری : ".Get::$from_username; |
||||
| 905 | } |
||||
| 906 | $msg .="\n\n یوزر آیدی : ".Get::$from_id."\n\n تعداد پیام های ارسالی در گروهها : ".$User->MSGCount."\n\n تعداد تشکر ها : ".$User->ThankCount .PHP_EOL.PHP_EOL; |
||||
| 907 | if ($Member->WarnCount > 0) { |
||||
| 908 | $msg .= "اخطارها : $Member->WarnCount \n \n "; |
||||
| 909 | } |
||||
| 910 | $msg .= "رتبه : $Position"; |
||||
| 911 | if ($photo) { |
||||
| 912 | Send::sendPhoto(Get::$chat_id, $photo, $msg, null, false, Get::$message_id); |
||||
| 913 | } else { |
||||
| 914 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 915 | } |
||||
| 916 | } |
||||
| 917 | } elseif (preg_match('~امروز ?چن|^ساعت$|^تاریخ$|ساعت ?چن~', Get::$text)) { |
||||
| 918 | Send::sendMessage(Get::$chat_id, jdate("l, j F Y H:i:s", '', '', 'Asia/Tehran', 'en'), null, false, false, Get::$message_id); |
||||
| 919 | } elseif (strpos(Get::$callback_query_data ?? 'Null', '/captchaVerify_') !== false) { |
||||
| 920 | $explode_user_id = explode('_', Get::$callback_query_data)[1]; |
||||
| 921 | if ($user_id == $explode_user_id) { |
||||
| 922 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 923 | $DB->UpdateData('Users', $user_id, ['CaptchaStatus' => true], ['User_id' => $user_id]); |
||||
| 924 | } |
||||
| 925 | } 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
Loading history...
|
|||||
| 926 | $text = Get::$text; |
||||
| 927 | $msg = "اینم ".Get::$text." برای شما 😌 \n\n ".$words->$text; |
||||
| 928 | Send::sendMessage(Get::$chat_id, $msg, null, false, false, Get::$message_id); |
||||
| 929 | } elseif ($Group->Settings->ConversationStatus->Value && in_array(Get::$text, array_keys(get_object_vars($words = $DB->SelectData('Bot', 'conversation'))))) { |
||||
| 930 | $text = Get::$text; |
||||
| 931 | $rand_array = explode('&&&&', $words->$text); |
||||
| 932 | $num = sizeof($rand_array); |
||||
| 933 | Send::sendMessage(Get::$chat_id, $rand_array[rand(0, --$num)], null, false, false, Get::$message_id); |
||||
| 934 | } |
||||
| 935 | } |
||||
| 936 | 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)) { |
||||
| 937 | Chat::deleteMessage(Get::$chat_id, Get::$message_id); |
||||
| 938 | } |
||||
| 939 | foreach ($DB->SelectData('Bot/', 'Temp') as $Temp) { |
||||
| 940 | if ($Temp->Type == 'Welcome' && $Temp->Time + $Group->DelWlcMSGAfter < time()) { |
||||
| 941 | $DB->DeleteData('Bot/', 'Temp', ['id' => $Temp->id]); |
||||
| 942 | Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
| 943 | } elseif ($Temp->Type == 'ForceTOAddInGP' && $Temp->Time + $Group->DelForceAddMSGAfter < time()) { |
||||
| 944 | $DB->DeleteData('Bot/', 'Temp', ['id' => $Temp->id]); |
||||
| 945 | Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
| 946 | } elseif ($Temp->Type == 'ForceTOChannelJoin' && $Temp->Time + $Group->DelForceJoinMSGAfter < time()) { |
||||
| 947 | $DB->DeleteData('Bot/', 'Temp', ['id' => $Temp->id]); |
||||
| 948 | Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
| 949 | } elseif ($Temp->Type == 'Captcha' && $Temp->Time + $Group->DelCaptchaMSGAfter < time()) { |
||||
| 950 | $DB->DeleteData('Bot/', 'Temp', ['id' => $Temp->id]); |
||||
| 951 | Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
| 952 | } elseif ($Temp->Type == 'Warn' && $Temp->Time + $Group->DelWarnMSGAfter < time()) { |
||||
| 953 | $DB->DeleteData('Bot/', 'Temp', ['id' => $Temp->id]); |
||||
| 954 | Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
| 955 | } elseif ($Temp->Type == 'Report' && $Temp->Time + $Group->DelReportMSGAfter < time()) { |
||||
| 956 | $DB->DeleteData('Bot/', 'Temp', ['id' => $Temp->id]); |
||||
| 957 | Chat::deleteMessage($Temp->Chat_id, $Temp->Message_id); |
||||
| 958 | } |
||||
| 959 | } |
||||
| 960 | } |
||||
| 961 |