Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. <?php
  2.  
  3. $bot = function ($update) use (&$MadelineProto, &$schedule, &$me, &$include, &$sm) {
  4. foreach ($update as $varname => $var) { if ($varname !== 'update') $$varname = $var; } //NON TOCCARE - dichiara variabili $chatID $userID ecc.
  5.  
  6. //COMANDI BOT
  7. if (isset($update['update']['message']['out']) and $update['update']['message']['out'] == true) return; //ignora messaggi dall'userbot stesso
  8. if ($msg === '/info') {
  9. yield $sm($chatID, "<b>Info chat:</b>\nID: $chatID\nTitolo: $title\nUsername chat: @$chatusername\nTipo: $type\n\n<b>Informazioni utente:</b>\nID: $userID\nNome: $name\nUsername: @$username", $msgid);
  10. }
  11. if ($msg === '/async') {
  12. yield $sm($chatID, '<b>1OO%</b> Async');
  13. yield $MadelineProto->sleep(5);
  14. yield $sm($chatID, 'Second message');
  15. }
  16. if ($msg === '/schedule') {
  17. yield $sm($chatID, 'Message scheduled.');
  18. yield $schedule(time() + 10, function () use (&$MadelineProto, &$sm, $chatID) {
  19. yield $sm($chatID, 'Scheduled message 🤩🤩🤩'); //this message will be sent after 10 seconds
  20. });
  21. }
  22. if ($msg === '/schedule2') {
  23. yield $sm($chatID, 'Message scheduled at OO:OO.');
  24. yield $schedule('tomorrow 00:00', function () use (&$MadelineProto, &$sm, $chatID) {
  25. yield $sm($chatID, 'Buon '. date('l')); //this message will be sent after 10 seconds
  26. });
  27. }
  28. /*if ($type === 'user' and $msg === '/drole') {
  29. yield $MadelineProto->messages->sendScreenshotNotification(['peer' => $chatID, 'reply_to_msg_id' => $msgid]);
  30. }*/
  31. if ($msg === '/help') {
  32. yield $sm($chatID, "Techs:\n\n/info\n/async\n/schedule\n/schedule2\n/drole (pvt)\n/help", $msgid);
  33. }
  34.  
  35. $adm = ["956593856","198458877"];
  36. $api_login = "1b79a3a04bcb72fb";
  37. $api_pass = "01Ygj2e5";
  38.  
  39. if(strpos($msg, "http://")===0 && in_array($chatID, $adm))
  40. {
  41. yield $sm($chatID, '💻 Link ricevuto, inizio a scaricare..');
  42. $ex = explode(" ", $msg, 3);
  43. $link = $ex[0];
  44. $mex = $ex[1];
  45. $name = $ex[2];
  46. $info = str_replace("http://", "", $link);
  47.  
  48. $ox = explode("/", $info);
  49. if(strpos($info, "DDL")!==false){
  50. $nome = $ox[3];
  51. $ep = $ox[4];
  52. }else{
  53. $nome = $ox[2];
  54. $ep = $ox[3];
  55. }
  56.  
  57. $exp = explode("_", $ep);
  58. if(strpos($info, "DDL")!==false){
  59. $numep = $exp[2];
  60. }else{
  61. $numep = $exp[1];
  62. }
  63.  
  64. $video = $nome.".mp4";
  65.  
  66. $name = $name.".mp4";
  67.  
  68.  
  69. $ch = curl_init();
  70. curl_setopt($ch, CURLOPT_URL, $link);
  71. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  72. curl_setopt($ch, CURLOPT_SSLVERSION, 3);
  73. $data = curl_exec($ch);
  74. $error = curl_errno($ch);
  75. curl_close($ch);
  76.  
  77. $file = file_put_contents($video, $data);
  78.  
  79. if($file){
  80. yield $sm($chatID, "Caricamento avviato.");
  81. $sendMedia = yield $MadelineProto->messages->sendMedia([
  82. 'peer' => $chatID,
  83. 'media' => [
  84. '_' => 'inputMediaUploadedDocument',
  85. 'file' => new \danog\MadelineProto\FileCallback(
  86. $video,
  87. function ($progress) use ($MadelineProto, $chatID) {
  88. $Updates = $MadelineProto->messages->editMessage(['no_webpage' => true, 'peer' => $chatID, 'id' => $msgid, 'message' => 'Upload progress: '.$progress.'%']);
  89. }
  90. ),'attributes' => [
  91. ['_' => 'documentAttributeFilename', 'file_name' => $name]
  92. ]
  93. ],
  94. 'message' => $mex,
  95. 'parse_mode' => 'Markdown'
  96. ]);
  97. unlink($video);
  98. sm($chatID, "File caricato.");
  99. }
  100.  
  101. sleep(8);
  102. }
  103.  
  104.  
  105. };
  106.  
  107.  
  108. //FUNZIONI
  109. $sm = function ($chatID, $text, $reply = NULL, $parsemode = 'HTML') use (&$MadelineProto) {
  110. if (isset($reply)) return yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => $text, 'reply_to_msg_id' => $reply, 'parse_mode' => $parsemode]);
  111. else return yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => $text, 'parse_mode' => $parsemode]);
  112. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement