Advertisement
mju478

Untitled

Jun 25th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. <?php
  2. date_default_timezone_set('Asia/Baghdad');
  3. if (!file_exists('madeline.php')) {
  4. copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
  5. }
  6. $admin = '@RH_BoT';
  7. include 'madeline.php';
  8. $settings['app_info']['api_id'] = 210897;
  9. $settings['app_info']['api_hash'] = 'c7d2d161d83ce18d56c1a8a54437f5ff';
  10. $MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
  11. $MadelineProto->start();
  12. $user = readline('enter username : ');
  13. $type = readline('Enter type (u/c/h/b): ');
  14. if($type == 'h'){
  15. $ch = readline('Enter Channel : ');
  16. } elseif($type == 'c'){
  17. $updates = $MadelineProto->channels->createChannel(['broadcast' => true, 'megagroup' => false, 'title' => "$admin", 'about'=>".", ]);
  18. $ch = $updates['updates'][1];
  19. } elseif($type == 'b'){
  20. $MadelineProto->messages->sendMessage(['peer' => '@botfather','message'=>'/newbot']);
  21. sleep(1);
  22. $MadelineProto->messages->sendMessage(['peer' => '@botfather','message'=>$admin]);
  23. }
  24. $i = 1;
  25.  
  26. $MadelineProto->messages->sendMessage(['peer' => $admin, 'message' => "Start : @$user"]);
  27. $t = $MadelineProto->get_info($user)['type'];
  28.  
  29. while(1){
  30. try {
  31. if($t == 'channel'){
  32. $m = $MadelineProto->channels->getChannels(['id' => [$user], ])['chats'][0];
  33. } else {
  34. $m = $MadelineProto->users->getUsers(['id' => [$user]])[0];
  35. }
  36. if(strtolower($m['username']) != strtolower($user)){
  37. if($type == 'u'){
  38. $MadelineProto->account->updateUsername(['username' => $user]);
  39. $msg = 'in account';
  40. } elseif($type == 'c' or $type == 'h'){
  41. $MadelineProto->channels->updateUsername(['channel' =>$ch, 'username' => $user, ]);
  42. if(is_string($ch)){
  43. $msg = 'in channel '.$ch;
  44. } else {
  45. $msg = 'in channel';
  46. }
  47. } elseif($type == 'b'){
  48. $MadelineProto->messages->sendMessage(['peer' => '@botfather','message'=>$user]);
  49. $msg = 'in bot';
  50. }
  51. $MadelineProto->messages->sendMessage(['peer' => $admin, 'message' => "Done @$user"]);
  52. exit();
  53. }
  54. echo $m['username'].' - '.$i.' = '.date('s')."\n——\n";
  55. $i++;
  56. } catch(Exception $e){
  57. if($e->getMessage() == 'Undefined index: username' or $e->getMessage() == 'You haven\'t joined this channel/supergroup' ){
  58. $Bool = $MadelineProto->account->checkUsername(['username' => $user, ]);
  59. if($Bool){
  60. if($type == 'u'){
  61. $MadelineProto->account->updateUsername(['username' => $user]);
  62. $msg = 'in account';
  63. } elseif($type == 'c' or $type == 'h'){
  64. $MadelineProto->channels->updateUsername(['channel' =>$ch, 'username' => $user, ]);
  65. if(is_string($ch)){
  66. $msg = 'in channel @'.$ch;
  67. } else {
  68. $msg = 'in channel';
  69. }
  70. } elseif($type == 'b'){
  71. $MadelineProto->messages->sendMessage(['peer' => '@botfather','message'=>$user]);
  72. $msg = 'in bot';
  73. }
  74. $MadelineProto->messages->sendMessage(['peer' => $admin, 'message' => "Done @$user"]);
  75. exit();
  76. }
  77. } else {
  78. $MadelineProto->messages->sendMessage(['peer' => $admin, 'message' => $e->getMessage()]);
  79. exit();
  80. }
  81. echo $e->getMessage();
  82.  
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement