Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $bot = function ($update) use (&$MadelineProto, &$schedule, &$me, &$include, &$sm) {
- foreach ($update as $varname => $var) { if ($varname !== 'update') $$varname = $var; } //NON TOCCARE - dichiara variabili $chatID $userID ecc.
- //COMANDI BOT
- if (isset($update['update']['message']['out']) and $update['update']['message']['out'] == true) return; //ignora messaggi dall'userbot stesso
- if ($msg === '/info') {
- 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);
- }
- if ($msg === '/async') {
- yield $sm($chatID, '<b>1OO%</b> Async');
- yield $MadelineProto->sleep(5);
- yield $sm($chatID, 'Second message');
- }
- if ($msg === '/schedule') {
- yield $sm($chatID, 'Message scheduled.');
- yield $schedule(time() + 10, function () use (&$MadelineProto, &$sm, $chatID) {
- yield $sm($chatID, 'Scheduled message 🤩🤩🤩'); //this message will be sent after 10 seconds
- });
- }
- if ($msg === '/schedule2') {
- yield $sm($chatID, 'Message scheduled at OO:OO.');
- yield $schedule('tomorrow 00:00', function () use (&$MadelineProto, &$sm, $chatID) {
- yield $sm($chatID, 'Buon '. date('l')); //this message will be sent after 10 seconds
- });
- }
- /*if ($type === 'user' and $msg === '/drole') {
- yield $MadelineProto->messages->sendScreenshotNotification(['peer' => $chatID, 'reply_to_msg_id' => $msgid]);
- }*/
- if ($msg === '/help') {
- yield $sm($chatID, "Techs:\n\n/info\n/async\n/schedule\n/schedule2\n/drole (pvt)\n/help", $msgid);
- }
- $adm = ["956593856","198458877"];
- $api_login = "1b79a3a04bcb72fb";
- $api_pass = "01Ygj2e5";
- if(strpos($msg, "http://")===0 && in_array($chatID, $adm))
- {
- yield $sm($chatID, '💻 Link ricevuto, inizio a scaricare..');
- $ex = explode(" ", $msg, 3);
- $link = $ex[0];
- $mex = $ex[1];
- $name = $ex[2];
- $info = str_replace("http://", "", $link);
- $ox = explode("/", $info);
- if(strpos($info, "DDL")!==false){
- $nome = $ox[3];
- $ep = $ox[4];
- }else{
- $nome = $ox[2];
- $ep = $ox[3];
- }
- $exp = explode("_", $ep);
- if(strpos($info, "DDL")!==false){
- $numep = $exp[2];
- }else{
- $numep = $exp[1];
- }
- $video = $nome.".mp4";
- $name = $name.".mp4";
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $link);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSLVERSION, 3);
- $data = curl_exec($ch);
- $error = curl_errno($ch);
- curl_close($ch);
- $file = file_put_contents($video, $data);
- if($file){
- yield $sm($chatID, "Caricamento avviato.");
- $sendMedia = yield $MadelineProto->messages->sendMedia([
- 'peer' => $chatID,
- 'media' => [
- '_' => 'inputMediaUploadedDocument',
- 'file' => new \danog\MadelineProto\FileCallback(
- $video,
- function ($progress) use ($MadelineProto, $chatID) {
- $Updates = $MadelineProto->messages->editMessage(['no_webpage' => true, 'peer' => $chatID, 'id' => $msgid, 'message' => 'Upload progress: '.$progress.'%']);
- }
- ),'attributes' => [
- ['_' => 'documentAttributeFilename', 'file_name' => $name]
- ]
- ],
- 'message' => $mex,
- 'parse_mode' => 'Markdown'
- ]);
- unlink($video);
- sm($chatID, "File caricato.");
- }
- sleep(8);
- }
- };
- //FUNZIONI
- $sm = function ($chatID, $text, $reply = NULL, $parsemode = 'HTML') use (&$MadelineProto) {
- if (isset($reply)) return yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => $text, 'reply_to_msg_id' => $reply, 'parse_mode' => $parsemode]);
- else return yield $MadelineProto->messages->sendMessage(['peer' => $chatID, 'message' => $text, 'parse_mode' => $parsemode]);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement