2018-02-27 20:07:59 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require '_config.php';
|
|
|
|
register_shutdown_function('failUpdates');
|
|
|
|
|
|
|
|
$MadelineProto = new \danog\MadelineProto\API("session.madeline");
|
|
|
|
|
|
|
|
register_shutdown_function('endUpdates');
|
|
|
|
echo "<h1>USERBOT PARTITO</h1>";
|
|
|
|
|
|
|
|
$running = true;
|
|
|
|
$offset = 0;
|
|
|
|
$lastser = time();
|
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
try {
|
|
|
|
while($running)
|
2018-02-27 20:07:59 +01:00
|
|
|
{
|
2018-02-27 22:25:26 +01:00
|
|
|
$updates = $MadelineProto->get_updates(['offset' => $offset]);
|
|
|
|
foreach($updates as $update)
|
2018-02-27 20:07:59 +01:00
|
|
|
{
|
2018-02-27 22:25:26 +01:00
|
|
|
$offset = $update['update_id'] + 1;
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
if (isset($update['update']['message']['out']) && $update['update']['message']['out'] && !$leggi_messaggi_in_uscita) {
|
|
|
|
continue;
|
2018-02-27 20:07:59 +01:00
|
|
|
}
|
2018-02-27 22:25:26 +01:00
|
|
|
$up = $update['update']['_'];
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
if($up == 'updateNewMessage' or $up == 'updateNewChannelMessage')
|
|
|
|
{
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
if (isset($update['update']['message']['message'])){
|
|
|
|
$msg = $update["update"]["message"]["message"];
|
|
|
|
}
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
if (isset($update['update']['message']['to_id']['channel_id'])) {
|
|
|
|
$chatID = $update['update']['message']['to_id']['channel_id'];
|
|
|
|
$chatID = '-100'.$chatID;
|
|
|
|
$type = "supergruppo";
|
|
|
|
}
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
if (isset($update['update']['message']['to_id']['chat_id'])) {
|
|
|
|
$chatID = $update['update']['message']['to_id']['chat_id'];
|
|
|
|
$chatID = '-'.$chatID;
|
|
|
|
$type = "gruppo";
|
|
|
|
}
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:57:48 +01:00
|
|
|
try {
|
|
|
|
require "_comandi.php";
|
|
|
|
} catch(Exception $e) {
|
|
|
|
if (isset($chatID)) {
|
|
|
|
try {
|
|
|
|
sm($chatID,'<code>'.$e.'</code>');
|
|
|
|
} catch(Exception $e) { }
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
if (isset($update['update']['message']['to_id']['user_id'])) {
|
|
|
|
$chatID = $update['update']['message']['from_id'];
|
|
|
|
$type = "privato";
|
|
|
|
}
|
|
|
|
|
|
|
|
@include("_comandi.php");
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
}
|
2018-02-27 20:07:59 +01:00
|
|
|
|
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
if(isset($msg)) unset($msg);
|
|
|
|
if(isset($chatID)) unset($chatID);
|
|
|
|
if(isset($userID)) unset($userID);
|
|
|
|
if(isset($up)) unset($up);
|
2018-02-27 20:07:59 +01:00
|
|
|
|
2018-02-27 22:25:26 +01:00
|
|
|
}
|
2018-02-27 20:07:59 +01:00
|
|
|
}
|
2018-02-27 22:25:26 +01:00
|
|
|
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
|
|
|
\danog\MadelineProto\Logger::log([(string)$e]);
|
|
|
|
if (in_array($e->rpc, ['SESSION_REVOKED', 'AUTH_KEY_UNREGISTERED'])) {
|
|
|
|
foreach (glob('session.madeline*') as $path) {
|
|
|
|
unlink($path);
|
|
|
|
}
|
|
|
|
}
|
2018-02-27 20:07:59 +01:00
|
|
|
}
|