diff --git a/magna.php b/magna.php index 79687914..8093766c 100755 --- a/magna.php +++ b/magna.php @@ -102,8 +102,10 @@ $calls = []; $offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id switch ($update['update']['_']) { case 'updateNewMessage': - include('songs.php'); - if ($update['update']['message']['out'] || $update['update']['message']['to_id']['_'] !== 'peerUser' || !isset($update['update']['message']['from_id'])) continue; + include 'songs.php'; + if ($update['update']['message']['out'] || $update['update']['message']['to_id']['_'] !== 'peerUser' || !isset($update['update']['message']['from_id'])) { + continue; + } try { $MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => 'Call me!']); } catch (\danog\MadelineProto\RPCErrorException $e) { diff --git a/songs.php b/songs.php index ae282c50..e0277496 100644 --- a/songs.php +++ b/songs.php @@ -8,4 +8,6 @@ $songs = [ // 'Swingrowers - Butterfly' => 'inputc.raw', // 'Postmodern Jukebox - Thrift Shop' => 'inputd.raw', ]; -for ($x = 0; $x < count($songs); $x++) { shuffle($songs); } +for ($x = 0; $x < count($songs); $x++) { + shuffle($songs); +}