From 64d878a28d979a2d5011904e8794f77aeb3b2dcf Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 30 Mar 2018 16:02:34 +0000 Subject: [PATCH] Magnaluna fixes --- magna.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/magna.php b/magna.php index ad18a36e2..ad2100d1e 100755 --- a/magna.php +++ b/magna.php @@ -44,13 +44,14 @@ $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 { - private $times = []; - private $times_messages = []; - private $calls = []; - private $my_users = []; - public function configureCall($call) { include 'songs.php'; @@ -112,12 +113,15 @@ Propic art by @magnaluna on [deviantart](https://magnaluna.deviantart.com).", 'p } if ($message === '/broadcast' && $from_id === 101374607) { $time = time() + 100; + $message = explode(" ", $message, 2); + unset($message[0]); + $message = implode(" ", $message); foreach ($this->get_dialogs() as $peer) { $this->times_messages[] = [$peer, $time, $message]; if (isset($peer['user_id'])) { $this->programmed_call[] = [$peer['user_id'], $time]; - $time += 30; } + $time += 30; } } } catch (\danog\MadelineProto\RPCErrorException $e) {