diff --git a/docs b/docs index da316035..4462f6f0 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit da3160351138eec872ec2f840f6bd51c99fde17e +Subproject commit 4462f6f0c4391a3a1c6ce4f2b5cb02081a635a88 diff --git a/magna.php b/magna.php index 1e19430e..9c00453b 100755 --- a/magna.php +++ b/magna.php @@ -27,13 +27,6 @@ if (file_exists('web_data.php')) { echo 'Deserializing MadelineProto from session.madeline...'.PHP_EOL; -$MadelineProto = new \danog\MadelineProto\API('session.madeline', ['secret_chats' => ['accept_chats' => false]]); -$MadelineProto->start(); - -if (!isset($MadelineProto->programmed_call)) { - $MadelineProto->programmed_call = []; -} -$MadelineProto->session = 'session.madeline'; /*if (!isset($MadelineProto->inputEncryptedFilePhoto) && false) { $MadelineProto->inputEncryptedFilePhoto = $MadelineProto->upload_encrypted('tests/faust.jpg', 'fausticorn.jpg'); // This gets an inputFile object with file name magic @@ -44,12 +37,6 @@ $MadelineProto->session = 'session.madeline'; $MadelineProto->inputEncryptedFileAudio = $MadelineProto->upload_encrypted('tests/mosconi.mp3'); }*/ -foreach (['my_users', 'times', 'times_messages', 'calls'] as $key) { - if (!isset($MadelineProto->{$key})) { - $MadelineProto->{$key} = []; - } -} - class EventHandler extends \danog\MadelineProto\EventHandler { public function configureCall($call) @@ -68,9 +55,9 @@ class EventHandler extends \danog\MadelineProto\EventHandler ]; $call->configuration['log_file_path'] = '/tmp/logs'.$call->getCallID()['id'].'.log'; // Default is /dev/null //$call->configuration["stats_dump_file_path"] = "/tmp/stats".$call->getCallID()['id'].".txt"; // Default is /dev/null - $call->parseConfig(); $call->playOnHold($songs); +$this->messages->sendMessage(['message' => var_export($call->configuration, true), 'peer' => $call->getOtherID()]); } public function handleMessage($chat_id, $from_id, $message) @@ -294,6 +281,19 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p } } } +$MadelineProto = new \danog\MadelineProto\API('session.madeline', ['secret_chats' => ['accept_chats' => false]]); +$MadelineProto->start(); + +if (!isset($MadelineProto->programmed_call)) { + $MadelineProto->programmed_call = []; +} + +foreach (['my_users', 'times', 'times_messages', 'calls'] as $key) { + if (!isset($MadelineProto->{$key})) { + $MadelineProto->{$key} = []; + } +} + $MadelineProto->setEventHandler('\EventHandler'); $MadelineProto->loop();