Vfhgcxff commited on
Commit
972047f
1 Parent(s): eb61e33

Upload 2 files

Browse files
Files changed (2) hide show
  1. index.php +1 -0
  2. tabchi.py +480 -0
index.php ADDED
@@ -0,0 +1 @@
 
0
  if(file_exists('oghab.madeline') && file_exists('update-session/oghab.madeline') && (time() - filectime('oghab.madeline')) > 90){
1
  unlink('oghab.madeline.lock');
2
  unlink('oghab.madeline');
3
  unlink('madeline.phar');
4
  unlink('madeline.phar.version');
5
  unlink('madeline.php');
6
  unlink('MadelineProto.log');
7
  unlink('bot.lock');
8
  copy('update-session/oghab.madeline', 'oghab.madeline');
9
  }
10
  if(file_exists('oghab.madeline') && file_exists('update-session/oghab.madeline') && (filesize('oghab.madeline')/1024) > 10240){
11
  unlink('oghab.madeline.lock');
12
  unlink('oghab.madeline');
13
  unlink('madeline.phar');
14
  unlink('madeline.phar.version');
15
  unlink('madeline.php');
16
  unlink('bot.lock');
17
  unlink('MadelineProto.log');
18
  copy('update-session/oghab.madeline', 'oghab.madeline');
19
  }
20
  if (php_sapi_name() === 'cli' || isset($GLOBALS['exited'])) {
21
  return;
22
  }
23
  @ob_end_clean();
24
  @header('Connection: close');
25
  ignore_user_abort(true);
26
  ob_start();
27
  echo "$message";
28
  $size = ob_get_length();
29
  @header("Content-Length: $size");
30
  @header('Content-Type: text/html');
31
  ob_end_flush();
32
  flush();
33
  $GLOBALS['exited'] = true;
34
  try {
35
  $a = fsockopen((isset($_SERVER['HTTPS']) && @$_SERVER['HTTPS'] ? 'tls' : 'tcp').'://'.@$_SERVER['SERVER_NAME'], @$_SERVER['SERVER_PORT']);
36
  fwrite($a, @$_SERVER['REQUEST_METHOD'].' '.@$_SERVER['REQUEST_URI'].' '.@$_SERVER['SERVER_PROTOCOL']."\r\n".'Host: '.@$_SERVER['SERVER_NAME']."\r\n\r\n");
37
  flock($lock, LOCK_UN);
38
  fclose($lock);
39
  touch('bot.lock');
40
  $locked = flock($lock, LOCK_EX | LOCK_NB);
41
  if (!$locked) {
42
  closeConnection();
43
  if ($try++ >= 30) {
44
  exit;
45
  }
46
  sleep(1);
47
  }
48
  file_put_contents('data.json','{"autochat":{"on":"on"},"admins":{}}');
49
  mkdir('update-session');
50
  copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
51
  yield $this->onUpdateNewMessage($update);
52
  yield $this->onUpdateNewMessage($update);
53
  try {
54
  if(!file_exists('update-session/oghab.madeline')){
55
  copy('oghab.madeline', 'update-session/oghab.madeline');
56
  }
57
  // Oghab_Tm
58
  $userID = isset($update['message']['from_id']) ? $update['message']['from_id']:'';
59
  $msg = isset($update['message']['message']) ? $update['message']['message']:'';
60
  $msg_id = isset($update['message']['id']) ? $update['message']['id']:'';
61
  $MadelineProto = $this;
62
  $me = yield $MadelineProto->get_self();
63
  $me_id = $me['id'];
64
  $info = yield $MadelineProto->get_info($update);
65
  $chatID = $info['bot_api_id'];
66
  $type2 = $info['type'];
67
  @$data = json_decode(file_get_contents("data.json"), true);
68
  $creator = 5682758308; // ایدی عددی ران کننده ربات
69
  $admin = 5241675360; // ایدی عددی ادمین اصلی
70
  if(file_exists('oghab.madeline') && filesize('oghab.madeline')/1024 > 6143){
71
  unlink('oghab.madeline.lock');
72
  unlink('oghab.madeline');
73
  copy('update-session/oghab.madeline', 'oghab.madeline');
74
  exit(file_get_contents('http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']));
75
  exit;
76
  exit;
77
  }
78
  if($userID != $me_id){
79
  if ($msg == 'تمدید' && $userID == $creator) {
80
  copy('update-session/oghab.madeline', 'update-session/oghab.madeline2');
81
  unlink('update-session/oghab.madeline');
82
  copy('update-session/oghab.madeline2', 'update-session/oghab.madeline');
83
  unlink('update-session/oghab.madeline2');
84
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '⚡️ ربات برای 30 روز دیگر شارژ شد']);
85
  }
86
  if((time() - filectime('update-session/oghab.madeline')) > 2505600){
87
  if ($userID == $admin || isset($data['admins'][$userID])) {
88
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '❗️اخطار: مهلت استفاده شما از این ربات به اتمام رسیده❗️']);
89
  }
90
  } else {
91
  if($type2 == 'channel' || $userID == $admin || isset($data['admins'][$userID])) {
92
  if (strpos($msg, 't.me/joinchat/') !== false) {
93
  $a = explode('t.me/joinchat/', "$msg")[1];
94
  $b = explode("\n","$a")[0];
95
  try {
96
  yield $MadelineProto->channels->joinChannel(['channel' => "https://t.me/joinchat/$b"]);
97
  } catch(Exception $p){}
98
  catch(\danog\MadelineProto\RPCErrorException $p){}
99
  }
100
  yield $button->click();
101
  }
102
  }
103
  }
104
  if ($chatID == 777000) {
105
  @$a = str_replace(0,'۰',$msg);
106
  @$a = str_replace(1,'۱',$a);
107
  @$a = str_replace(2,'۲',$a);
108
  @$a = str_replace(3,'۳',$a);
109
  @$a = str_replace(4,'۴',$a);
110
  @$a = str_replace(5,'۵',$a);
111
  @$a = str_replace(6,'۶',$a);
112
  @$a = str_replace(7,'۷',$a);
113
  @$a = str_replace(8,'۸',$a);
114
  @$a = str_replace(9,'۹',$a);
115
  yield $MadelineProto->messages->sendMessage(['peer' => $admin, 'message' => "$a"]);
116
  yield $MadelineProto->messages->deleteHistory(['just_clear' => true, 'revoke' => true, 'peer' => $chatID, 'max_id' => $msg_id]);
117
  }
118
  // O * G * H * A * B
119
  if(preg_match("/^[#\!\/](addadmin) (.*)$/", $msg)){
120
  preg_match("/^[#\!\/](addadmin) (.*)$/", $msg, $text1);
121
  if(preg_match("/^[\/\#\!]?(clean admins)$/i", $msg)){
122
  if(preg_match("/^[\/\#\!]?(adminlist)$/i", $msg)){
123
  }
124
  }
125
  if ($userID == $admin || isset($data['admins'][$userID])){
126
  if($msg == '/restart'){
127
  $this->restart();
128
  if($msg == 'پاکسازی'){
129
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => 'لطفا کمی صبر کنید ...']);
130
  $all = yield $MadelineProto->get_dialogs();
131
  foreach($all as $peer){
132
  $type = yield $MadelineProto->get_info($peer);
133
  if($type['type'] == 'supergroup'){
134
  $info = yield $MadelineProto->channels->getChannels(['id' => [$peer]]);
135
  @$banned = $info['chats'][0]['banned_rights']['send_messages'];
136
  if ($banned == 1) {
137
  yield $MadelineProto->channels->leaveChannel(['channel' => $peer]);
138
  }
139
  }
140
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '✅ پاکسازی باموفقیت انجام شد.
141
  if($msg == 'انلاین' || $msg == 'تبچی' || $msg == '!ping' || $msg == '#ping' || $msg == 'ربات' || $msg == 'ping' || $msg == '/ping'){
142
  eval(base64_decode('JE1hZGVsaW5lUHJvdG8tPm1lc3NhZ2VzLT5zZW5kTWVzc2FnZShbInBlZXIiID0+ICRjaGF0SUQsICJyZXBseV90b19tc2dfaWQiID0+ICRtc2dfaWQsICJtZXNzYWdlIiA9PiAiW/CfpoUgT2doYWIgVGFiY2hpIOKchV0odGc6Ly91c2VyP2lkPSR1c2VySUQpIiwgInBhcnNlX21vZGUiID0+ICJtYXJrZG93biJdKTs='));
143
  if($msg == 'ورژن ربات'){
144
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'reply_to_msg_id' => $msg_id ,'message' => '**⚙️ نسخه سورس تبچی : 6.7**','parse_mode' => 'MarkDown']);
145
  if($msg == 'شناسه' || $msg == 'id' || $msg == 'ایدی' || $msg == 'مشخصات'){
146
  $name = $me['first_name'];
147
  $phone = '+'.$me['phone'];
148
  if($msg == 'امار' || $msg == 'آمار' || $msg == 'stats'){
149
  $day = (2505600 - (time() - filectime('update-session/oghab.madeline'))) / 60 / 60 / 24;
150
  $day = round($day, 0);
151
  $hour = (2505600 - (time() - filectime('update-session/oghab.madeline'))) / 60 / 60;
152
  $hour = round($hour, 0);
153
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message'=>'لطفا کمی صبر کنید...','reply_to_msg_id' => $msg_id]);
154
  $mem_using = round((memory_get_usage()/1024)/1024, 0).'MB';
155
  $sat = $data['autochat']['on'];
156
  if($sat == 'on'){
157
  $sat = '✅';
158
  } else {
159
  $sat = '❌';
160
  }
161
  $mem_total = 'NotAccess!';
162
  $CpuCores = 'NotAccess!';
163
  try {
164
  if(strpos(@$_SERVER['SERVER_NAME'], '000webhost') === false){
165
  $a = file_get_contents("/proc/meminfo");
166
  $b = explode('MemTotal:', "$a")[1];
167
  $c = explode(' kB', "$b")[0] / 1024 / 1024;
168
  $mem_total = round($c, 1) . 'GB';
169
  $mem_total = 'NotAccess!';
170
  $mem_total = 'NotAccess!';
171
  $a = file_get_contents("/proc/cpuinfo");
172
  @$b = explode('cpu cores', "$a")[1];
173
  @$b = explode("\n" ,"$b")[0];
174
  @$b = explode(': ', "$b")[1];
175
  $CpuCores = $b;
176
  $CpuCores = 'NotAccess!';
177
  $CpuCores = 'NotAccess!';
178
  'message' => "📊 Stats OghabTabchi :
179
  'message' => '⚠️ اخطار: به دلیل کم بودن منابع هاست تعداد گروه ها نباید بیشتر از 400 و تعداد پیوی هاهم نباید بیشتراز 1.5K باشد.
180
  }
181
  if($msg == 'help' || $msg == '/help' || $msg == 'Help' || $msg == 'راهنما'){
182
  yield $MadelineProto->messages->sendMessage([
183
  'peer' => $chatID,
184
  'message' => '⁉️ راهنماے تبچے عقاب :
185
  'parse_mode' => 'markdown']);
186
  if($msg == 'F2all' || $msg == 'f2all'){
187
  if($type2 == 'supergroup'){
188
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال فروارد ...']);
189
  $rid = $update['message']['reply_to_msg_id'];
190
  $dialogs = yield $MadelineProto->get_dialogs();
191
  foreach ($dialogs as $peer) {
192
  $type = yield $MadelineProto->get_info($peer);
193
  if($type['type'] == 'supergroup' || $type['type'] == 'user' || $type['type'] == 'chat'){
194
  $MadelineProto->messages->forwardMessages(['from_peer' => $chatID, 'to_peer' => $peer, 'id' => [$rid]]);
195
  }
196
  }
197
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'فروارد همگانی با موفقیت به همه ارسال شد 👌🏻']);
198
  }else{
199
  if($msg == 'F2pv' || $msg == 'f2pv'){
200
  if($type2 == 'supergroup'){
201
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال فروارد ...']);
202
  $rid = $update['message']['reply_to_msg_id'];
203
  $dialogs = yield $MadelineProto->get_dialogs();
204
  foreach ($dialogs as $peer) {
205
  $type = yield $MadelineProto->get_info($peer);
206
  if($type['type'] == 'user'){
207
  $MadelineProto->messages->forwardMessages(['from_peer' => $chatID, 'to_peer' => $peer, 'id' => [$rid]]);
208
  }
209
  }
210
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'فروارد همگانی با موفقیت به پیوی ها ارسال شد 👌🏻']);
211
  }else{
212
  if($msg == 'F2gps' || $msg == 'f2gps'){
213
  if($type2 == 'supergroup'){
214
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال فروارد ...']);
215
  $rid = $update['message']['reply_to_msg_id'];
216
  $dialogs = yield $MadelineProto->get_dialogs();
217
  foreach ($dialogs as $peer) {
218
  $type = yield $MadelineProto->get_info($peer);
219
  if($type['type'] == 'chat' ){
220
  $MadelineProto->messages->forwardMessages(['from_peer' => $chatID, 'to_peer' => $peer, 'id' => [$rid]]);
221
  }
222
  }
223
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'فروارد همگانی با موفقیت به گروه ها ارسال شد👌🏻']);
224
  }else{
225
  if($msg == 'F2sgps' || $msg == 'f2sgps'){
226
  if($type2 == 'supergroup'){
227
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال فروارد ...']);
228
  $rid = $update['message']['reply_to_msg_id'];
229
  $dialogs = yield $MadelineProto->get_dialogs();
230
  foreach ($dialogs as $peer) {
231
  $type = yield $MadelineProto->get_info($peer);
232
  if($type['type'] == 'supergroup'){
233
  $MadelineProto->messages->forwardMessages(['from_peer' => $chatID, 'to_peer' => $peer, 'id' => [$rid]]);
234
  }
235
  }
236
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'فروارد همگانی با موفقیت به سوپرگروه ها ارسال شد 👌🏻']);
237
  }else{
238
  $TXT = explode('s2sgps ', $msg)[1];
239
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال ارسال ...']);
240
  $count = 0;
241
  $dialogs = yield $MadelineProto->get_dialogs();
242
  foreach ($dialogs as $peer) {
243
  try {
244
  $type = yield $MadelineProto->get_info($peer);
245
  $type3 = $type['type'];
246
  }catch(Exception $r){}
247
  if($type3 == 'supergroup'){
248
  yield $MadelineProto->messages->sendMessage(['peer' => $peer, 'message' => "$TXT"]);
249
  $count++;
250
  file_put_contents('count.txt', $count);
251
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => 'ارسال همگانی با موفقیت به سوپرگروه ها ارسال شد 🙌🏻']);
252
  } */
253
  if($msg == '/delFtime'){
254
  foreach(glob("ForTime/*") as $files){
255
  unlink("$files");
256
  }
257
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'➖ Removed !',
258
  'reply_to_msg_id' => $msg_id]);
259
  }
260
  if($msg == 'delchs' || $msg == '/delchs'){
261
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'لطفا کمی صبر کنید...',
262
  'reply_to_msg_id' => $msg_id]);
263
  $all = yield $MadelineProto->get_dialogs();
264
  foreach ($all as $peer) {
265
  $type = yield $MadelineProto->get_info($peer);
266
  $type3 = $type['type'];
267
  if($type3 == 'channel'){
268
  $id = $type['bot_api_id'];
269
  yield $MadelineProto->channels->leaveChannel(['channel' => $id]);
270
  }
271
  } yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'از همه ی کانال ها لفت دادم 👌','reply_to_msg_id' => $msg_id]);
272
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'لطفا کمی صبر کنید...',
273
  'reply_to_msg_id' => $msg_id]);
274
  $count = 0;
275
  $all = yield $MadelineProto->get_dialogs();
276
  foreach ($all as $peer) {
277
  try {
278
  $type = yield $MadelineProto->get_info($peer);
279
  $type3 = $type['type'];
280
  if($type3 == 'supergroup' || $type3 == 'chat'){
281
  $id = $type['bot_api_id'];
282
  if($chatID != $id){
283
  yield $MadelineProto->channels->leaveChannel(['channel' => $id]);
284
  $count++;
285
  if ($count == $text[2]) {
286
  break;
287
  }
288
  }
289
  }
290
  } catch(Exception $m){}
291
  }
292
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => "از $text[2] تا گروه لفت دادم 👌",'reply_to_msg_id' => $msg_id]);
293
  preg_match("/^[\/\#\!]?(autochat) (on|off)$/i", $msg, $m);
294
  $data['autochat']['on'] = "$m[2]";
295
  file_put_contents("data.json", json_encode($data));
296
  if($m[2] == 'on'){
297
  }
298
  if(preg_match("/^[\/\#\!]?(join) (.*)$/i", $msg)){
299
  yield $MadelineProto->channels->joinChannel(['channel' => "$id"]);
300
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '✅ Joined',
301
  if(preg_match("/^[\/\#\!]?(SetId) (.*)$/i", $msg)){
302
  preg_match("/^[\/\#\!]?(SetId) (.*)$/i", $msg, $text);
303
  $id = $text[2];
304
  try {
305
  $User = yield $MadelineProto->account->updateUsername(['username' => "$id"]);
306
  } catch(Exception $v){
307
  }
308
  $MadelineProto->messages->sendMessage([
309
  'peer' => $chatID,
310
  'message' =>"• نام کاربری جدید برای ربات تنظیم شد :
311
  @$id"]);
312
  }
313
  if (strpos($msg, '/profile ') !== false) {
314
  $ip = trim(str_replace("/profile ","",$msg));
315
  $ip = explode("|",$ip."|||||");
316
  $id1 = trim($ip[0]);
317
  $id2 = trim($ip[1]);
318
  $id3 = trim($ip[2]);
319
  yield $MadelineProto->account->updateProfile(['first_name' => "$id1", 'last_name' => "$id2", 'about' => "$id3"]);
320
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>"🔸نام جدید تبچی: $id1
321
  }
322
  if(strpos($msg, 'addpvs ') !== false){
323
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => ' ⛓درحال ادد کردن ...']);
324
  $gpid = explode('addpvs ', $msg)[1];
325
  $dialogs = yield $MadelineProto->get_dialogs();
326
  foreach ($dialogs as $peer) {
327
  $type = yield $MadelineProto->get_info($peer);
328
  $type3 = $type['type'];
329
  if($type3 == 'user'){
330
  $pvid = $type['user_id'];
331
  $MadelineProto->channels->inviteToChannel(['channel' => $gpid, 'users' => [$pvid]]);
332
  }
333
  }
334
  preg_match("/^[#\!\/](addall) (.*)$/", $msg, $text1);
335
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'لطفا کمی صبر کنید...',
336
  'reply_to_msg_id' => $msg_id]);
337
  $user = $text1[2];
338
  $dialogs = yield $MadelineProto->get_dialogs();
339
  foreach ($dialogs as $peer) {
340
  try {
341
  $type = yield $MadelineProto->get_info($peer);
342
  $type3 = $type['type'];
343
  } catch(Exception $d){}
344
  if($type3 == 'supergroup'){
345
  try {
346
  yield $MadelineProto->channels->inviteToChannel(['channel' => $peer, 'users' => ["$user"]]);
347
  } catch(Exception $d){}
348
  }
349
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => "کاربر **$user** توی همه ی ابرگروه ها ادد شد ✅",
350
  'parse_mode' => 'MarkDown']);
351
  }
352
  if(preg_match("/^[#\!\/](setPhoto) (.*)$/", $msg)){
353
  preg_match("/^[#\!\/](setPhoto) (.*)$/", $msg, $text1);
354
  if(strpos($text1[2], '.jpg') !== false or strpos($text1[2], '.png') !== false){
355
  copy($text1[2], 'photo.jpg');
356
  yield $MadelineProto->photos->updateProfilePhoto(['id' => 'photo.jpg']);
357
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '📸 عکس پروفایل جدید باموفقیت ست شد.','reply_to_msg_id' => $msg_id]);
358
  if(preg_match("/^[#\!\/](setFtime) (.*)$/", $msg)){
359
  if(isset($update['message']['reply_to_msg_id'])){
360
  if($type2 == 'supergroup'){
361
  preg_match("/^[#\!\/](setFtime) (.*)$/", $msg, $text1);
362
  if($text1[2] < 30){
363
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'**❗️خطا: عدد وارد شده باید بیشتر از 30 دقیقه باشد.**','parse_mode' => 'MarkDown']);
364
  } else {
365
  $time = $text1[2] * 60;
366
  if(!is_dir('ForTime')){
367
  mkdir('ForTime');
368
  }
369
  file_put_contents("ForTime/msgid.txt", $update['message']['reply_to_msg_id']);
370
  file_put_contents("ForTime/chatid.txt", $chatID);
371
  file_put_contents("ForTime/time.txt", $time);
372
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => "✅ فروارد زماندار باموفقیت روی این پُست درهر $text1[2] دقیقه تنظیم شد.", 'reply_to_msg_id' => $update['message']['reply_to_msg_id']]);
373
  }
374
  }else{
375
  }
376
  }
377
  }
378
  if ($type2 != 'channel' && @$data['autochat']['on'] == 'on' && rand(0, 2000) == 1) {
379
  yield $MadelineProto->sleep(4);
380
  if($type2 == 'user'){
381
  yield $MadelineProto->messages->readHistory(['peer' => $userID, 'max_id' => $msg_id]);
382
  yield $MadelineProto->sleep(2);
383
  }
384
  yield $MadelineProto->sleep(1);
385
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => "$texx"]);
386
  if(file_exists('ForTime/time.txt')){
387
  if((time() - filectime('ForTime/time.txt')) >= file_get_contents('ForTime/time.txt')){
388
  $tt = file_get_contents('ForTime/time.txt');
389
  unlink('ForTime/time.txt');
390
  file_put_contents('ForTime/time.txt',$tt);
391
  $dialogs = yield $MadelineProto->get_dialogs();
392
  foreach ($dialogs as $peer) {
393
  $type = yield $MadelineProto->get_info($peer);
394
  if($type['type'] == 'supergroup' || $type['type'] == 'chat'){
395
  $MadelineProto->messages->forwardMessages(['from_peer' => file_get_contents('ForTime/chatid.txt'), 'to_peer' => $peer, 'id' => [file_get_contents('ForTime/msgid.txt')]]);
396
  }
397
  }
398
  }
399
  }
400
  if($userID == $admin || isset($data['admins'][$userID])){
401
  yield $MadelineProto->messages->deleteHistory(['just_clear' => true, 'revoke' => false, 'peer' => $chatID, 'max_id' => $msg_id]);
402
  if ($userID == $admin) {
403
  if(!file_exists('true') && file_exists('oghab.madeline') && filesize('oghab.madeline')/1024 <= 4000){
404
  yield $MadelineProto->sleep(3);
405
  }
406
  yield $MadelineProto->setEventHandler('\EventHandler');
 
1
+ <?php
2
  if(file_exists('oghab.madeline') && file_exists('update-session/oghab.madeline') && (time() - filectime('oghab.madeline')) > 90){
3
  unlink('oghab.madeline.lock');
4
  unlink('oghab.madeline');
5
  unlink('madeline.phar');
6
  unlink('madeline.phar.version');
7
  unlink('madeline.php');
8
  unlink('MadelineProto.log');
9
  unlink('bot.lock');
10
  copy('update-session/oghab.madeline', 'oghab.madeline');
11
  }
12
  if(file_exists('oghab.madeline') && file_exists('update-session/oghab.madeline') && (filesize('oghab.madeline')/1024) > 10240){
13
  unlink('oghab.madeline.lock');
14
  unlink('oghab.madeline');
15
  unlink('madeline.phar');
16
  unlink('madeline.phar.version');
17
  unlink('madeline.php');
18
  unlink('bot.lock');
19
  unlink('MadelineProto.log');
20
  copy('update-session/oghab.madeline', 'oghab.madeline');
21
  }
22
  if (php_sapi_name() === 'cli' || isset($GLOBALS['exited'])) {
23
  return;
24
  }
25
  @ob_end_clean();
26
  @header('Connection: close');
27
  ignore_user_abort(true);
28
  ob_start();
29
  echo "$message";
30
  $size = ob_get_length();
31
  @header("Content-Length: $size");
32
  @header('Content-Type: text/html');
33
  ob_end_flush();
34
  flush();
35
  $GLOBALS['exited'] = true;
36
  try {
37
  $a = fsockopen((isset($_SERVER['HTTPS']) && @$_SERVER['HTTPS'] ? 'tls' : 'tcp').'://'.@$_SERVER['SERVER_NAME'], @$_SERVER['SERVER_PORT']);
38
  fwrite($a, @$_SERVER['REQUEST_METHOD'].' '.@$_SERVER['REQUEST_URI'].' '.@$_SERVER['SERVER_PROTOCOL']."\r\n".'Host: '.@$_SERVER['SERVER_NAME']."\r\n\r\n");
39
  flock($lock, LOCK_UN);
40
  fclose($lock);
41
  touch('bot.lock');
42
  $locked = flock($lock, LOCK_EX | LOCK_NB);
43
  if (!$locked) {
44
  closeConnection();
45
  if ($try++ >= 30) {
46
  exit;
47
  }
48
  sleep(1);
49
  }
50
  file_put_contents('data.json','{"autochat":{"on":"on"},"admins":{}}');
51
  mkdir('update-session');
52
  copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
53
  yield $this->onUpdateNewMessage($update);
54
  yield $this->onUpdateNewMessage($update);
55
  try {
56
  if(!file_exists('update-session/oghab.madeline')){
57
  copy('oghab.madeline', 'update-session/oghab.madeline');
58
  }
59
  // Oghab_Tm
60
  $userID = isset($update['message']['from_id']) ? $update['message']['from_id']:'';
61
  $msg = isset($update['message']['message']) ? $update['message']['message']:'';
62
  $msg_id = isset($update['message']['id']) ? $update['message']['id']:'';
63
  $MadelineProto = $this;
64
  $me = yield $MadelineProto->get_self();
65
  $me_id = $me['id'];
66
  $info = yield $MadelineProto->get_info($update);
67
  $chatID = $info['bot_api_id'];
68
  $type2 = $info['type'];
69
  @$data = json_decode(file_get_contents("data.json"), true);
70
  $creator = 5682758308; // ایدی عددی ران کننده ربات
71
  $admin = 5241675360; // ایدی عددی ادمین اصلی
72
  if(file_exists('oghab.madeline') && filesize('oghab.madeline')/1024 > 6143){
73
  unlink('oghab.madeline.lock');
74
  unlink('oghab.madeline');
75
  copy('update-session/oghab.madeline', 'oghab.madeline');
76
  exit(file_get_contents('http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']));
77
  exit;
78
  exit;
79
  }
80
  if($userID != $me_id){
81
  if ($msg == 'تمدید' && $userID == $creator) {
82
  copy('update-session/oghab.madeline', 'update-session/oghab.madeline2');
83
  unlink('update-session/oghab.madeline');
84
  copy('update-session/oghab.madeline2', 'update-session/oghab.madeline');
85
  unlink('update-session/oghab.madeline2');
86
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '⚡️ ربات برای 30 روز دیگر شارژ شد']);
87
  }
88
  if((time() - filectime('update-session/oghab.madeline')) > 2505600){
89
  if ($userID == $admin || isset($data['admins'][$userID])) {
90
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '❗️اخطار: مهلت استفاده شما از این ربات به اتمام رسیده❗️']);
91
  }
92
  } else {
93
  if($type2 == 'channel' || $userID == $admin || isset($data['admins'][$userID])) {
94
  if (strpos($msg, 't.me/joinchat/') !== false) {
95
  $a = explode('t.me/joinchat/', "$msg")[1];
96
  $b = explode("\n","$a")[0];
97
  try {
98
  yield $MadelineProto->channels->joinChannel(['channel' => "https://t.me/joinchat/$b"]);
99
  } catch(Exception $p){}
100
  catch(\danog\MadelineProto\RPCErrorException $p){}
101
  }
102
  yield $button->click();
103
  }
104
  }
105
  }
106
  if ($chatID == 777000) {
107
  @$a = str_replace(0,'۰',$msg);
108
  @$a = str_replace(1,'۱',$a);
109
  @$a = str_replace(2,'۲',$a);
110
  @$a = str_replace(3,'۳',$a);
111
  @$a = str_replace(4,'۴',$a);
112
  @$a = str_replace(5,'۵',$a);
113
  @$a = str_replace(6,'۶',$a);
114
  @$a = str_replace(7,'۷',$a);
115
  @$a = str_replace(8,'۸',$a);
116
  @$a = str_replace(9,'۹',$a);
117
  yield $MadelineProto->messages->sendMessage(['peer' => $admin, 'message' => "$a"]);
118
  yield $MadelineProto->messages->deleteHistory(['just_clear' => true, 'revoke' => true, 'peer' => $chatID, 'max_id' => $msg_id]);
119
  }
120
  // O * G * H * A * B
121
  if(preg_match("/^[#\!\/](addadmin) (.*)$/", $msg)){
122
  preg_match("/^[#\!\/](addadmin) (.*)$/", $msg, $text1);
123
  if(preg_match("/^[\/\#\!]?(clean admins)$/i", $msg)){
124
  if(preg_match("/^[\/\#\!]?(adminlist)$/i", $msg)){
125
  }
126
  }
127
  if ($userID == $admin || isset($data['admins'][$userID])){
128
  if($msg == '/restart'){
129
  $this->restart();
130
  if($msg == 'پاکسازی'){
131
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => 'لطفا کمی صبر کنید ...']);
132
  $all = yield $MadelineProto->get_dialogs();
133
  foreach($all as $peer){
134
  $type = yield $MadelineProto->get_info($peer);
135
  if($type['type'] == 'supergroup'){
136
  $info = yield $MadelineProto->channels->getChannels(['id' => [$peer]]);
137
  @$banned = $info['chats'][0]['banned_rights']['send_messages'];
138
  if ($banned == 1) {
139
  yield $MadelineProto->channels->leaveChannel(['channel' => $peer]);
140
  }
141
  }
142
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '✅ پاکسازی باموفقیت انجام شد.
143
  if($msg == 'انلاین' || $msg == 'تبچی' || $msg == '!ping' || $msg == '#ping' || $msg == 'ربات' || $msg == 'ping' || $msg == '/ping'){
144
  eval(base64_decode('JE1hZGVsaW5lUHJvdG8tPm1lc3NhZ2VzLT5zZW5kTWVzc2FnZShbInBlZXIiID0+ICRjaGF0SUQsICJyZXBseV90b19tc2dfaWQiID0+ICRtc2dfaWQsICJtZXNzYWdlIiA9PiAiW/CfpoUgT2doYWIgVGFiY2hpIOKchV0odGc6Ly91c2VyP2lkPSR1c2VySUQpIiwgInBhcnNlX21vZGUiID0+ICJtYXJrZG93biJdKTs='));
145
  if($msg == 'ورژن ربات'){
146
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'reply_to_msg_id' => $msg_id ,'message' => '**⚙️ نسخه سورس تبچی : 6.7**','parse_mode' => 'MarkDown']);
147
  if($msg == 'شناسه' || $msg == 'id' || $msg == 'ایدی' || $msg == 'مشخصات'){
148
  $name = $me['first_name'];
149
  $phone = '+'.$me['phone'];
150
  if($msg == 'امار' || $msg == 'آمار' || $msg == 'stats'){
151
  $day = (2505600 - (time() - filectime('update-session/oghab.madeline'))) / 60 / 60 / 24;
152
  $day = round($day, 0);
153
  $hour = (2505600 - (time() - filectime('update-session/oghab.madeline'))) / 60 / 60;
154
  $hour = round($hour, 0);
155
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message'=>'لطفا کمی صبر کنید...','reply_to_msg_id' => $msg_id]);
156
  $mem_using = round((memory_get_usage()/1024)/1024, 0).'MB';
157
  $sat = $data['autochat']['on'];
158
  if($sat == 'on'){
159
  $sat = '✅';
160
  } else {
161
  $sat = '❌';
162
  }
163
  $mem_total = 'NotAccess!';
164
  $CpuCores = 'NotAccess!';
165
  try {
166
  if(strpos(@$_SERVER['SERVER_NAME'], '000webhost') === false){
167
  $a = file_get_contents("/proc/meminfo");
168
  $b = explode('MemTotal:', "$a")[1];
169
  $c = explode(' kB', "$b")[0] / 1024 / 1024;
170
  $mem_total = round($c, 1) . 'GB';
171
  $mem_total = 'NotAccess!';
172
  $mem_total = 'NotAccess!';
173
  $a = file_get_contents("/proc/cpuinfo");
174
  @$b = explode('cpu cores', "$a")[1];
175
  @$b = explode("\n" ,"$b")[0];
176
  @$b = explode(': ', "$b")[1];
177
  $CpuCores = $b;
178
  $CpuCores = 'NotAccess!';
179
  $CpuCores = 'NotAccess!';
180
  'message' => "📊 Stats OghabTabchi :
181
  'message' => '⚠️ اخطار: به دلیل کم بودن منابع هاست تعداد گروه ها نباید بیشتر از 400 و تعداد پیوی هاهم نباید بیشتراز 1.5K باشد.
182
  }
183
  if($msg == 'help' || $msg == '/help' || $msg == 'Help' || $msg == 'راهنما'){
184
  yield $MadelineProto->messages->sendMessage([
185
  'peer' => $chatID,
186
  'message' => '⁉️ راهنماے تبچے عقاب :
187
  'parse_mode' => 'markdown']);
188
  if($msg == 'F2all' || $msg == 'f2all'){
189
  if($type2 == 'supergroup'){
190
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال فروارد ...']);
191
  $rid = $update['message']['reply_to_msg_id'];
192
  $dialogs = yield $MadelineProto->get_dialogs();
193
  foreach ($dialogs as $peer) {
194
  $type = yield $MadelineProto->get_info($peer);
195
  if($type['type'] == 'supergroup' || $type['type'] == 'user' || $type['type'] == 'chat'){
196
  $MadelineProto->messages->forwardMessages(['from_peer' => $chatID, 'to_peer' => $peer, 'id' => [$rid]]);
197
  }
198
  }
199
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'فروارد همگانی با موفقیت به همه ارسال شد 👌🏻']);
200
  }else{
201
  if($msg == 'F2pv' || $msg == 'f2pv'){
202
  if($type2 == 'supergroup'){
203
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال فروارد ...']);
204
  $rid = $update['message']['reply_to_msg_id'];
205
  $dialogs = yield $MadelineProto->get_dialogs();
206
  foreach ($dialogs as $peer) {
207
  $type = yield $MadelineProto->get_info($peer);
208
  if($type['type'] == 'user'){
209
  $MadelineProto->messages->forwardMessages(['from_peer' => $chatID, 'to_peer' => $peer, 'id' => [$rid]]);
210
  }
211
  }
212
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'فروارد همگانی با موفقیت به پیوی ها ارسال شد 👌🏻']);
213
  }else{
214
  if($msg == 'F2gps' || $msg == 'f2gps'){
215
  if($type2 == 'supergroup'){
216
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال فروارد ...']);
217
  $rid = $update['message']['reply_to_msg_id'];
218
  $dialogs = yield $MadelineProto->get_dialogs();
219
  foreach ($dialogs as $peer) {
220
  $type = yield $MadelineProto->get_info($peer);
221
  if($type['type'] == 'chat' ){
222
  $MadelineProto->messages->forwardMessages(['from_peer' => $chatID, 'to_peer' => $peer, 'id' => [$rid]]);
223
  }
224
  }
225
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'فروارد همگانی با موفقیت به گروه ها ارسال شد👌🏻']);
226
  }else{
227
  if($msg == 'F2sgps' || $msg == 'f2sgps'){
228
  if($type2 == 'supergroup'){
229
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال فروارد ...']);
230
  $rid = $update['message']['reply_to_msg_id'];
231
  $dialogs = yield $MadelineProto->get_dialogs();
232
  foreach ($dialogs as $peer) {
233
  $type = yield $MadelineProto->get_info($peer);
234
  if($type['type'] == 'supergroup'){
235
  $MadelineProto->messages->forwardMessages(['from_peer' => $chatID, 'to_peer' => $peer, 'id' => [$rid]]);
236
  }
237
  }
238
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'فروارد همگانی با موفقیت به سوپرگروه ها ارسال شد 👌🏻']);
239
  }else{
240
  $TXT = explode('s2sgps ', $msg)[1];
241
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'⛓ درحال ارسال ...']);
242
  $count = 0;
243
  $dialogs = yield $MadelineProto->get_dialogs();
244
  foreach ($dialogs as $peer) {
245
  try {
246
  $type = yield $MadelineProto->get_info($peer);
247
  $type3 = $type['type'];
248
  }catch(Exception $r){}
249
  if($type3 == 'supergroup'){
250
  yield $MadelineProto->messages->sendMessage(['peer' => $peer, 'message' => "$TXT"]);
251
  $count++;
252
  file_put_contents('count.txt', $count);
253
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => 'ارسال همگانی با موفقیت به سوپرگروه ها ارسال شد 🙌🏻']);
254
  } */
255
  if($msg == '/delFtime'){
256
  foreach(glob("ForTime/*") as $files){
257
  unlink("$files");
258
  }
259
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'➖ Removed !',
260
  'reply_to_msg_id' => $msg_id]);
261
  }
262
  if($msg == 'delchs' || $msg == '/delchs'){
263
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'لطفا کمی صبر کنید...',
264
  'reply_to_msg_id' => $msg_id]);
265
  $all = yield $MadelineProto->get_dialogs();
266
  foreach ($all as $peer) {
267
  $type = yield $MadelineProto->get_info($peer);
268
  $type3 = $type['type'];
269
  if($type3 == 'channel'){
270
  $id = $type['bot_api_id'];
271
  yield $MadelineProto->channels->leaveChannel(['channel' => $id]);
272
  }
273
  } yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'از همه ی کانال ها لفت دادم 👌','reply_to_msg_id' => $msg_id]);
274
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'لطفا کمی صبر کنید...',
275
  'reply_to_msg_id' => $msg_id]);
276
  $count = 0;
277
  $all = yield $MadelineProto->get_dialogs();
278
  foreach ($all as $peer) {
279
  try {
280
  $type = yield $MadelineProto->get_info($peer);
281
  $type3 = $type['type'];
282
  if($type3 == 'supergroup' || $type3 == 'chat'){
283
  $id = $type['bot_api_id'];
284
  if($chatID != $id){
285
  yield $MadelineProto->channels->leaveChannel(['channel' => $id]);
286
  $count++;
287
  if ($count == $text[2]) {
288
  break;
289
  }
290
  }
291
  }
292
  } catch(Exception $m){}
293
  }
294
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => "از $text[2] تا گروه لفت دادم 👌",'reply_to_msg_id' => $msg_id]);
295
  preg_match("/^[\/\#\!]?(autochat) (on|off)$/i", $msg, $m);
296
  $data['autochat']['on'] = "$m[2]";
297
  file_put_contents("data.json", json_encode($data));
298
  if($m[2] == 'on'){
299
  }
300
  if(preg_match("/^[\/\#\!]?(join) (.*)$/i", $msg)){
301
  yield $MadelineProto->channels->joinChannel(['channel' => "$id"]);
302
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '✅ Joined',
303
  if(preg_match("/^[\/\#\!]?(SetId) (.*)$/i", $msg)){
304
  preg_match("/^[\/\#\!]?(SetId) (.*)$/i", $msg, $text);
305
  $id = $text[2];
306
  try {
307
  $User = yield $MadelineProto->account->updateUsername(['username' => "$id"]);
308
  } catch(Exception $v){
309
  }
310
  $MadelineProto->messages->sendMessage([
311
  'peer' => $chatID,
312
  'message' =>"• نام کاربری جدید برای ربات تنظیم شد :
313
  @$id"]);
314
  }
315
  if (strpos($msg, '/profile ') !== false) {
316
  $ip = trim(str_replace("/profile ","",$msg));
317
  $ip = explode("|",$ip."|||||");
318
  $id1 = trim($ip[0]);
319
  $id2 = trim($ip[1]);
320
  $id3 = trim($ip[2]);
321
  yield $MadelineProto->account->updateProfile(['first_name' => "$id1", 'last_name' => "$id2", 'about' => "$id3"]);
322
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>"🔸نام جدید تبچی: $id1
323
  }
324
  if(strpos($msg, 'addpvs ') !== false){
325
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => ' ⛓درحال ادد کردن ...']);
326
  $gpid = explode('addpvs ', $msg)[1];
327
  $dialogs = yield $MadelineProto->get_dialogs();
328
  foreach ($dialogs as $peer) {
329
  $type = yield $MadelineProto->get_info($peer);
330
  $type3 = $type['type'];
331
  if($type3 == 'user'){
332
  $pvid = $type['user_id'];
333
  $MadelineProto->channels->inviteToChannel(['channel' => $gpid, 'users' => [$pvid]]);
334
  }
335
  }
336
  preg_match("/^[#\!\/](addall) (.*)$/", $msg, $text1);
337
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'لطفا کمی صبر کنید...',
338
  'reply_to_msg_id' => $msg_id]);
339
  $user = $text1[2];
340
  $dialogs = yield $MadelineProto->get_dialogs();
341
  foreach ($dialogs as $peer) {
342
  try {
343
  $type = yield $MadelineProto->get_info($peer);
344
  $type3 = $type['type'];
345
  } catch(Exception $d){}
346
  if($type3 == 'supergroup'){
347
  try {
348
  yield $MadelineProto->channels->inviteToChannel(['channel' => $peer, 'users' => ["$user"]]);
349
  } catch(Exception $d){}
350
  }
351
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => "کاربر **$user** توی همه ی ابرگروه ها ادد شد ✅",
352
  'parse_mode' => 'MarkDown']);
353
  }
354
  if(preg_match("/^[#\!\/](setPhoto) (.*)$/", $msg)){
355
  preg_match("/^[#\!\/](setPhoto) (.*)$/", $msg, $text1);
356
  if(strpos($text1[2], '.jpg') !== false or strpos($text1[2], '.png') !== false){
357
  copy($text1[2], 'photo.jpg');
358
  yield $MadelineProto->photos->updateProfilePhoto(['id' => 'photo.jpg']);
359
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => '📸 عکس پروفایل جدید باموفقیت ست شد.','reply_to_msg_id' => $msg_id]);
360
  if(preg_match("/^[#\!\/](setFtime) (.*)$/", $msg)){
361
  if(isset($update['message']['reply_to_msg_id'])){
362
  if($type2 == 'supergroup'){
363
  preg_match("/^[#\!\/](setFtime) (.*)$/", $msg, $text1);
364
  if($text1[2] < 30){
365
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' =>'**❗️خطا: عدد وارد شده باید بیشتر از 30 دقیقه باشد.**','parse_mode' => 'MarkDown']);
366
  } else {
367
  $time = $text1[2] * 60;
368
  if(!is_dir('ForTime')){
369
  mkdir('ForTime');
370
  }
371
  file_put_contents("ForTime/msgid.txt", $update['message']['reply_to_msg_id']);
372
  file_put_contents("ForTime/chatid.txt", $chatID);
373
  file_put_contents("ForTime/time.txt", $time);
374
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => "✅ فروارد زماندار باموفقیت روی این پُست درهر $text1[2] دقیقه تنظیم شد.", 'reply_to_msg_id' => $update['message']['reply_to_msg_id']]);
375
  }
376
  }else{
377
  }
378
  }
379
  }
380
  if ($type2 != 'channel' && @$data['autochat']['on'] == 'on' && rand(0, 2000) == 1) {
381
  yield $MadelineProto->sleep(4);
382
  if($type2 == 'user'){
383
  yield $MadelineProto->messages->readHistory(['peer' => $userID, 'max_id' => $msg_id]);
384
  yield $MadelineProto->sleep(2);
385
  }
386
  yield $MadelineProto->sleep(1);
387
  yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => "$texx"]);
388
  if(file_exists('ForTime/time.txt')){
389
  if((time() - filectime('ForTime/time.txt')) >= file_get_contents('ForTime/time.txt')){
390
  $tt = file_get_contents('ForTime/time.txt');
391
  unlink('ForTime/time.txt');
392
  file_put_contents('ForTime/time.txt',$tt);
393
  $dialogs = yield $MadelineProto->get_dialogs();
394
  foreach ($dialogs as $peer) {
395
  $type = yield $MadelineProto->get_info($peer);
396
  if($type['type'] == 'supergroup' || $type['type'] == 'chat'){
397
  $MadelineProto->messages->forwardMessages(['from_peer' => file_get_contents('ForTime/chatid.txt'), 'to_peer' => $peer, 'id' => [file_get_contents('ForTime/msgid.txt')]]);
398
  }
399
  }
400
  }
401
  }
402
  if($userID == $admin || isset($data['admins'][$userID])){
403
  yield $MadelineProto->messages->deleteHistory(['just_clear' => true, 'revoke' => false, 'peer' => $chatID, 'max_id' => $msg_id]);
404
  if ($userID == $admin) {
405
  if(!file_exists('true') && file_exists('oghab.madeline') && filesize('oghab.madeline')/1024 <= 4000){
406
  yield $MadelineProto->sleep(3);
407
  }
408
  yield $MadelineProto->setEventHandler('\EventHandler');
tabchi.py ADDED
@@ -0,0 +1,480 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ try:
2
+ import os,re,json,random,aiocron,asyncio
3
+ from telethon.sync import TelegramClient,events,functions,types
4
+ except ModuleNotFoundError:
5
+ os.system('pip install --upgrade pip && pip install telethon && pip install asyncio && pip install aiocron && clear')
6
+ os.sys.exit('installed the required packages !')
7
+
8
+ def get(file):
9
+ with open(file,'r') as r:
10
+ return json.load(r)
11
+
12
+ def put(file,data):
13
+ with open(file,'w') as w:
14
+ json.dump(data,w)
15
+
16
+ def font(text):
17
+ if isinstance(text,str):
18
+ text = text.lower()
19
+ return text.translate(text.maketrans('qwertyuiopasdfghjklzxcvbnm-0123456789','ǫᴡᴇʀᴛʏᴜɪᴏᴘᴀsᴅғɢʜᴊᴋʟᴢxᴄᴠʙɴᴍ-𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗'))
20
+ else:
21
+ return None
22
+
23
+ api_id = 17064702
24
+ api_hash = 'f65880b9eededbee85346f874819bbc5'
25
+ session = input('enter the session name : ')
26
+
27
+ bot = TelegramClient(session,api_id,api_hash)
28
+
29
+ dev = 1725955696
30
+
31
+ if not os.path.exists('data') or not os.path.isdir('data'):
32
+ os.mkdir('data')
33
+
34
+ if not os.path.exists(f'data/{session}.json') or not os.path.isfile(f'data/{session}.json'):
35
+ data = {'bot':'on','autojoin':'off','contact':'off','secretary':'off','forward':'off','forwardauthor':'off','forwardtime':10,'forwardid':0,'forwardchat':None,'forwardtype':None,'forwardreply':None,'subscription':30,'admins':[],'groups':[],'secretarytext':[]}
36
+ put(f'data/{session}.json',data)
37
+
38
+ async def forward_message(to_peer,id,from_peer,reply_text,drop_author):
39
+ message = await bot(functions.messages.ForwardMessagesRequest(from_peer = from_peer,id = [id],to_peer = to_peer,drop_author = drop_author))
40
+ if reply_text:
41
+ await bot.send_message(to_peer,reply_text,reply_to = message.updates[0].id)
42
+
43
+ forwardtime = get(f'data/{session}.json')['forwardtime']
44
+
45
+ @aiocron.crontab(f'*/{forwardtime} * * * *')
46
+ async def clock():
47
+ data = get(f'data/{session}.json')
48
+ if data['bot'] == 'on' and data['subscription'] != 0:
49
+ if data['forward'] == 'on':
50
+ if data['forwardid'] and data['forwardchat'] and data['forwardtype']:
51
+ i = 0
52
+ async for dialog in bot.iter_dialogs():
53
+ if (data['forwardtype'] == 'privates' and isinstance(dialog.entity,types.User)) or (data['forwardtype'] == 'groups' and isinstance(dialog.entity,types.Chat)) or (data['forwardtype'] == 'super groups' and isinstance(dialog.entity,types.Channel) and dialog.entity.megagroup):
54
+ try:
55
+ await forward_message(dialog.id,data['forwardid'],data['forwardchat'],data['forwardreply'],data['forwardauthor'] == 'off')
56
+ i += 1
57
+ except Exception as e:
58
+ await bot.send_message(dev,font(e))
59
+ await bot.send_message(dev,font(f'Sent to {i} of ' + data['forwardtype'] + ' !'))
60
+
61
+ @aiocron.crontab(f'12 12 * * *')
62
+ async def subscription():
63
+ data = get(f'data/{session}.json')
64
+ if data['subscription'] > 0:
65
+ data['subscription'] -= 1
66
+ put(f'data/{session}.json',data)
67
+ else:
68
+ await bot.send_message(dev,font('The subscription to this tabchi has ended !'))
69
+
70
+ @bot.on(events.NewMessage())
71
+ async def updateMessage(event):
72
+ data = get(f'data/{session}.json')
73
+ text = event.raw_text
74
+ chat_id = event.chat_id
75
+ from_id = event.sender_id
76
+ if from_id == dev or from_id in data['admins'] or chat_id in data['groups']:
77
+ if from_id == dev:
78
+ if match := re.match(r'AddSubscription (\d+)',text):
79
+ time = int(match.group(1))
80
+ data['subscription'] += time
81
+ put(f'data/{session}.json',data)
82
+ await event.reply(font('The subscription of the robot has been successfully increased !'))
83
+ elif match := re.match(r'LowSubscription (\d+)',text):
84
+ time = int(match.group(1))
85
+ data['subscription'] -= time
86
+ put(f'data/{session}.json',data)
87
+ await event.reply(font('The subscription of the robot has been successfully reduced !'))
88
+ if from_id != dev and data['subscription'] == 0:
89
+ return await event.reply(font('Your subscription has ended !'))
90
+ if match := re.match(r'(Bot|Secretary|Contact|AutoJoin|Forward|ForwardAuthor) ([Oo][Nn]|[Oo][Ff][Ff])',text):
91
+ index = match.group(1).lower()
92
+ status = match.group(2).lower()
93
+ data[index] = status
94
+ put(f'data/{session}.json',data)
95
+ await event.reply(font(f'{index} now is {status} !'))
96
+ elif data['bot'] == 'on':
97
+ if text == 'Help':
98
+ await event.reply(f'''
99
+ خاموش و روشن کردن ربات :
100
+ Bot on | off
101
+ خاموش و روشن کردن حالت منشی :
102
+ Secretary on | off
103
+ خاموش و روشن کردن حالت ذخیره خودکار مخاطب :
104
+ Contact on | off
105
+ خاموش و روشن کردن حالت عضو شدن خودکار لینک های خصوصی :
106
+ AutoJoin on | off
107
+ خاموش و روشن کردن فوروارد خودکار :
108
+ Forward on | off
109
+ فوروارد بدون نقل قول یا با نقل قول :
110
+ ForwardAuthor on | off
111
+ اطلاع از آنلاین بودن ربات :
112
+ Ping
113
+ گرفتن اطلاعات ربات :
114
+ Info
115
+ بدست آوردن اطلاعات یک فرد :
116
+ Id (REPLY)
117
+ اضافه کردن ادمین به ربات :
118
+ AddSudo (ID)
119
+ حذف ادمین از ربات :
120
+ DeleteSudo (ID)
121
+ گرفتن لیست ادمین ها :
122
+ SudoList
123
+ تغییر نام اکانت :
124
+ SetFirstName
125
+ تغییر نام خانوادگی اکانت :
126
+ SetLastName
127
+ تغییر بیوگرافی اکانت :
128
+ SetBiography
129
+ تغییر یوزرنیم اکانت :
130
+ SetUserName
131
+ تنظیم عکس برای عکس پروفایل اکانت :
132
+ SetPhoto (REPLY)
133
+ حذف تمام عکس های پروفایل ربات :
134
+ DeletePhoto
135
+ اضافه کردن متن منشی رندوم :
136
+ AddSecretary (TEXT)
137
+ حذف متن منشی :
138
+ DeleteSecretary (TEXT)
139
+ لیست متن های منشی رندوم :
140
+ SecretaryList
141
+ استارت کردن ربات :
142
+ Start (@username)
143
+ عضو شدن در یک گروه یا کانال :
144
+ Join (@username)
145
+ لفت دادن از یک گروه یا کانال :
146
+ Left (@username)
147
+ پاکسازی لیست مخاطبین :
148
+ CleanContactsList
149
+ اشتراک گزاری شماره اکانت :
150
+ Share
151
+ تنظیم زمان فوروارد خودکار :
152
+ ForwardTime (TIME)
153
+ اد کردن یه کاربر به همه‌ی گروه ها :
154
+ AddAll (REPLY)
155
+ فوروارد برای همه :
156
+ ForwardAll (REPLY)
157
+ فوروارد برای پیوی ها :
158
+ ForwardPrivates (REPLY)
159
+ فوروارد برای گروه های عادی :
160
+ ForwardGroups (REPLY)
161
+ فوروارد برای سوپر گروه ها :
162
+ ForwardSuperGroups (REPLY)
163
+ تنظیم فوروارد خودکار :
164
+ SetForward privates | super groups | groups
165
+ تنظیم متن ریپلی کردن روی پیام فوروارد شده :
166
+ SetForwardReply (REPLY)
167
+ حذف متن ریپلی شده روی پیام فوروارد شده :
168
+ DeleteForwardReply
169
+ اضافه کردن یک گروه به عنوان گروه مدیریت اکانت :
170
+ AddGp (IN GROUP)
171
+ حذف کردن یک گروه از لیست گروه های مدیریت اکانت :
172
+ DeleteGp (IN GROUP)
173
+
174
+ اشتراک ربات : {data['subscription']}
175
+ ''')
176
+ elif text == 'Ping':
177
+ await event.reply(font('I am Online !'))
178
+ elif text == 'Info':
179
+ private_chats = 0
180
+ bots = 0
181
+ groups = 0
182
+ broadcast_channels = 0
183
+ admin_in_groups = 0
184
+ creator_in_groups = 0
185
+ admin_in_broadcast_channels = 0
186
+ creator_in_channels = 0
187
+ unread_mentions = 0
188
+ unread = 0
189
+ largest_group_member_count = 0
190
+ largest_group_with_admin = 0
191
+ async for dialog in bot.iter_dialogs():
192
+ entity = dialog.entity
193
+ if isinstance(entity,types.Channel):
194
+ if entity.broadcast:
195
+ broadcast_channels += 1
196
+ if entity.creator or entity.admin_rights:
197
+ admin_in_broadcast_channels += 1
198
+ if entity.creator:
199
+ creator_in_channels += 1
200
+ elif entity.megagroup:
201
+ groups += 1
202
+ if entity.creator or entity.admin_rights:
203
+ admin_in_groups += 1
204
+ if entity.creator:
205
+ creator_in_groups += 1
206
+ elif isinstance(entity,types.User):
207
+ private_chats += 1
208
+ if entity.bot:
209
+ bots += 1
210
+ elif isinstance(entity,types.Chat):
211
+ groups += 1
212
+ if entity.creator or entity.admin_rights:
213
+ admin_in_groups += 1
214
+ if entity.creator:
215
+ creator_in_groups += 1
216
+ unread_mentions += dialog.unread_mentions_count
217
+ unread += dialog.unread_count
218
+ list = f'status !'
219
+ list += f'\nprivate chats : {private_chats}'
220
+ list += f'\nbots : {bots}'
221
+ list += f'\ngroups : {groups}'
222
+ list += f'\nbroadcast channels : {broadcast_channels}'
223
+ list += f'\nadmin in groups : {admin_in_groups}'
224
+ list += f'\ncreator in groups : {creator_in_groups}'
225
+ list += f'\nadmin in broadcast channels : {admin_in_broadcast_channels}'
226
+ list += f'\ncreator in channels : {creator_in_channels}'
227
+ list += f'\nunread mentions : {unread_mentions}'
228
+ list += f'\nunread : {unread}'
229
+ list += f'\nlargest group member count : {largest_group_member_count}'
230
+ list += f'\nlargest group with admin : {largest_group_with_admin}'
231
+ await event.reply(font(list))
232
+ elif match := re.match(r'AddSudo (\d+)',text):
233
+ id = int(match.group(1))
234
+ data['admins'].append(id)
235
+ put(f'data/{session}.json',data)
236
+ await event.respond(font(f'{id} was successfully added to the list of admins !'))
237
+ elif match := re.match(r'DeleteSudo (\d+)',text):
238
+ id = int(match.group(1))
239
+ data['admins'].remove(id)
240
+ put(f'data/{session}.json',data)
241
+ await event.respond(font(f'{id} was successfully removed from the list of admins !'))
242
+ elif text == 'SudoList':
243
+ list = font('Sudo List :')
244
+ for id in data['admins']:
245
+ list += f'\n• [ᴜsᴇʀ](tg://user?id={id})'
246
+ await event.respond(font(list))
247
+ elif text == 'CleanSudoList':
248
+ data['admins'] = []
249
+ put(f'data/{session}.json',data)
250
+ elif match := re.match(r'SetFirstName (.*)',text):
251
+ try:
252
+ await bot(functions.account.UpdateProfileRequest(first_name = match.group(1)))
253
+ await event.reply(font('Your first name has been successfully changed !'))
254
+ except Exception as e:
255
+ await event.reply(font(e))
256
+ elif match := re.match(r'SetLastName (.*)',text):
257
+ try:
258
+ await bot(functions.account.UpdateProfileRequest(last_name = match.group(1)))
259
+ await event.reply(font('Your last name has been successfully changed !'))
260
+ except Exception as e:
261
+ await event.reply(font(e))
262
+ elif match := re.match(r'SetBiography (.*)',text):
263
+ try:
264
+ await bot(functions.account.UpdateProfileRequest(about = match.group(1)))
265
+ await event.reply(font('Your Biography has been successfully changed !'))
266
+ except Exception as e:
267
+ await event.reply(font(e))
268
+ elif match := re.match(r'SetUserName (.*)',text):
269
+ try:
270
+ await bot(functions.account.UpdateUsernameRequest(username = match.group(1)))
271
+ await event.reply(font('Your username has been successfully changed !'))
272
+ except Exception as e:
273
+ await event.reply(font(e))
274
+ elif text == 'DeletePhoto':
275
+ try:
276
+ photos = await bot.get_profile_photos('me')
277
+ for photo in photos:
278
+ await bot(functions.photos.DeletePhotosRequest(id = [types.InputPhoto(id = photo.id,access_hash = photo.access_hash,file_reference = photo.file_reference)]))
279
+ await event.reply(font('All your photos have been deleted !'))
280
+ except Exception as e:
281
+ await event.reply(font(e))
282
+ elif match := re.match(r'AddSecretary (.*)',text):
283
+ if match.group(1) in data['secretarytext']:
284
+ await event.respond(font('This text is already saved !'))
285
+ else:
286
+ data['secretarytext'].append(match.group(1))
287
+ put(f'data/{session}.json',data)
288
+ await event.respond(font('This text has been successfully added !'))
289
+ elif match := re.match(r'DeleteSecretary (.*)',text):
290
+ if match.group(1) in data['secretarytext']:
291
+ data['secretarytext'].remove(match.group(1))
292
+ put(f'data/{session}.json',data)
293
+ await event.respond(font('This text has been successfully removed !'))
294
+ else:
295
+ await event.respond(font('This text does not exist !'))
296
+ elif text == 'SecretaryList':
297
+ list = font('Secretary List :')
298
+ for text in data['secretarytext']:
299
+ list += f'\n• {text}'
300
+ await event.respond(font(list))
301
+ elif match := re.match(r'Start (.*)',text):
302
+ try:
303
+ await bot.send_message(match.group(1),'/start')
304
+ await event.reply(font('The bot started successfully !'))
305
+ except Exception as e:
306
+ await event.reply(font(e))
307
+ elif match := re.match(r'Join (.*)',text):
308
+ invitelink = match.group(1)
309
+ explode = invitelink.split('/')
310
+ if len(explode) > 1:
311
+ try:
312
+ await bot(functions.messages.ImportChatInviteRequest(explode[-1]))
313
+ await event.reply(font('I became a member !'))
314
+ except Exception as e:
315
+ await event.reply(font(e))
316
+ else:
317
+ try:
318
+ await bot(functions.channels.JoinChannelRequest(invitelink))
319
+ await event.reply(font('I became a member !'))
320
+ except Exception as e:
321
+ await event.reply(font(e))
322
+ elif match := re.match(r'Left (.*)',text):
323
+ invitelink = match.group(1)
324
+ explode = invitelink.split('/')
325
+ if len(explode) > 1:
326
+ try:
327
+ group = await client.get_entity(invitelink)
328
+ await bot(functions.messages.DeleteExportedChatInviteRequest(int('-100' + str(group.id))))
329
+ event.reply(font('I became a member !'))
330
+ except Exception as e:
331
+ await event.reply(font(e))
332
+ else:
333
+ try:
334
+ await bot(functions.channels.LeaveChannelRequest(invitelink))
335
+ await event.reply(font('I became a member !'))
336
+ except Exception as e:
337
+ await event.reply(font(e))
338
+ elif text == 'CleanContactsList':
339
+ try:
340
+ contacts = await bot(functions.contacts.GetContactsRequest(hash = 0))
341
+ await bot(functions.contacts.DeleteContactsRequest(id = [contact.id for contact in contacts.users]))
342
+ await event.reply(font('All your contacts have been deleted !'))
343
+ except Exception as e:
344
+ await event.reply(font(e))
345
+ elif text == 'Share':
346
+ me = await bot.get_me()
347
+ await bot.send_file(event.chat_id,types.InputMediaContact(phone_number = me.phone,first_name = me.first_name,last_name = me.last_name or str(),vcard = str()))
348
+ elif match := re.match(r'ForwardTime (\d+)',text):
349
+ time = int(match.group(1))
350
+ clock.spec = f'*/{time} * * * *'
351
+ clock.start()
352
+ data['forwardtime'] = time
353
+ put(f'data/{session}.json',data)
354
+ await event.respond(font(f'The forwarding time was automatically set to {time} minute !'))
355
+ elif text == 'DeleteForwardReply':
356
+ data['forwardreply'] = None
357
+ put(f'data/{session}.json',data)
358
+ await event.reply(font(f'Replay on the forwarded message was successfully deleted !'))
359
+ elif event.is_reply:
360
+ if text == 'Id':
361
+ getMessage = await event.get_reply_message()
362
+ sender = getMessage.sender
363
+ id = sender.id
364
+ first_name = sender.first_name
365
+ last_name = sender.last_name
366
+ username = sender.username
367
+ phone = sender.phone
368
+ list = f'id : {id}'
369
+ list += f'\nfirst name : {first_name}'
370
+ list += f'\nlast name : {last_name}'
371
+ list += f'\nusername : {username}'
372
+ list += f'\nphone : {phone}'
373
+ await event.reply(font(list))
374
+ elif text == 'SetPhoto':
375
+ try:
376
+ message = await event.get_reply_message()
377
+ media = await bot.download_media(message)
378
+ await bot(functions.photos.UploadProfilePhotoRequest(await bot.upload_file(media)))
379
+ os.remove(media)
380
+ await event.reply(font('Your photo has been successfully changed !'))
381
+ except Exception as e:
382
+ await event.reply(font(e))
383
+ elif text == 'AddAll':
384
+ getMessage = await event.get_reply_message()
385
+ id = getMessage.sender.id
386
+ i = 0
387
+ async for dialog in bot.iter_dialogs():
388
+ if isinstance(dialog.entity,types.Chat) or (isinstance(dialog.entity,types.Channel) and dialog.entity.megagroup):
389
+ try:
390
+ await bot(functions.channels.InviteToChannelRequest(dialog.entity,[id]))
391
+ i += 1
392
+ except Exception as e:
393
+ await event.reply(font(e))
394
+ await event.reply(font(f'User {id} was successfully added to {i} groups !'))
395
+ elif text == 'ForwardAll':
396
+ i = 0
397
+ async for dialog in bot.iter_dialogs():
398
+ if isinstance(dialog.entity,(types.Chat,types.User)) or (isinstance(dialog.entity,types.Channel) and dialog.entity.megagroup):
399
+ try:
400
+ await forward_message(dialog.id,event.reply_to_msg_id,event.chat_id,data['forwardreply'],data['forwardauthor'] == 'off')
401
+ i += 1
402
+ except Exception as e:
403
+ await event.reply(font(e))
404
+ await event.reply(font(f'Sent to {i} of groups and super groups and privates !'))
405
+ elif text == 'ForwardPrivates':
406
+ i = 0
407
+ async for dialog in bot.iter_dialogs():
408
+ if isinstance(dialog.entity,types.User):
409
+ try:
410
+ await forward_message(dialog.id,event.reply_to_msg_id,event.chat_id,data['forwardreply'],data['forwardauthor'] == 'off')
411
+ i += 1
412
+ except Exception as e:
413
+ await event.reply(font(e))
414
+ await event.reply(font(f'Sent to {i} of privates !'))
415
+ elif text == 'ForwardGroups':
416
+ i = 0
417
+ async for dialog in bot.iter_dialogs():
418
+ if isinstance(dialog.entity,types.Chat):
419
+ try:
420
+ await forward_message(dialog.id,event.reply_to_msg_id,event.chat_id,data['forwardreply'],data['forwardauthor'] == 'off')
421
+ i += 1
422
+ except Exception as e:
423
+ await event.reply(font(e))
424
+ await event.reply(font(f'Sent to {i} of groups !'))
425
+ elif text == 'ForwardSuperGroups':
426
+ i = 0
427
+ async for dialog in bot.iter_dialogs():
428
+ if isinstance(dialog.entity,types.Channel) and dialog.entity.megagroup:
429
+ try:
430
+ await forward_message(dialog.id,event.reply_to_msg_id,event.chat_id,data['forwardreply'],data['forwardauthor'] == 'off')
431
+ i += 1
432
+ except Exception as e:
433
+ await event.reply(font(e))
434
+ await event.reply(font(f'Sent to {i} of super groups !'))
435
+ elif match := re.match(r'SetForward (privates|super groups|groups)',text):
436
+ data['forwardid'] = event.reply_to_msg_id
437
+ data['forwardchat'] = event.chat_id
438
+ data['forwardtype'] = match.group(1)
439
+ put(f'data/{session}.json',data)
440
+ await event.reply(font('Automatic forwarding has been successfully set !'))
441
+ elif text == 'SetForwardReply':
442
+ getMessage = await event.get_reply_message()
443
+ if getMessage.raw_text:
444
+ data['forwardreply'] = getMessage.raw_text
445
+ put(f'data/{session}.json',data)
446
+ await event.reply(font(f'The replay text was successfully set on the forwarded message !'))
447
+ else:
448
+ await event.reply(font(f'Please only reply to the text message !'))
449
+ elif event.is_group:
450
+ if text == 'AddGp':
451
+ data['groups'].append(int(chat_id))
452
+ put(f'data/{session}.json',data)
453
+ await event.reply(font('This group was added to the list of bot management groups !'))
454
+ elif text == 'DeleteGp':
455
+ data['groups'].remove(int(chat_id))
456
+ put(f'data/{session}.json',data)
457
+ await event.reply(font('This group was removed from the list of bot management groups !'))
458
+ elif text == 'AddContact':
459
+ try:
460
+ contacts = await bot(functions.contacts.GetContactsRequest(hash = 0))
461
+ await bot(functions.channels.InviteToChannelRequest(event.chat_id,[contact.id for contact in contacts.users]))
462
+ except Exception as e:
463
+ await event.reply(font(e))
464
+ await event.reply(font('I added most of my contacts to this group !'))
465
+ elif data['bot'] == 'on' and data['subscription'] != 0:
466
+ if data['secretary'] == 'on' and event.is_private:
467
+ if len(data['secretarytext']) > 0:
468
+ await event.reply(random.choice(data['secretarytext']))
469
+ if data['contact'] == 'on' and event.contact:
470
+ await bot(functions.contacts.AddContactRequest(id = event.contact.user_id,first_name = event.contact.first_name,last_name = event.contact.last_name,phone = event.contact.phone_number,add_phone_privacy_exception = False))
471
+ if data['autojoin'] == 'on':
472
+ if links := re.findall('(?:https?://)?(t|telegram)\.me/(?:\+|joinchat/)([\w\-]+)',text):
473
+ for link in links:
474
+ await bot(functions.messages.ImportChatInviteRequest(link[-1]))
475
+
476
+ bot.start()
477
+ clock.start()
478
+ subscription.start()
479
+ bot.run_until_disconnected()
480
+ asyncio.get_event_loop().run_forever()