Some features

This commit is contained in:
Daniil Gentili 2017-08-05 15:43:07 +00:00
parent 296dcb8147
commit b0aff44321
3 changed files with 10 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
songs.php
_site
# JetBrains IDE

View File

@ -102,6 +102,14 @@ $calls = [];
\danog\MadelineProto\Logger::log([$update]);
$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;
try {
$MadelineProto->messages->sendMessage(['peer' => $update['update']['message']['from_id'], 'message' => 'Call me!']);
} catch (\danog\MadelineProto\RPCErrorException $e) {
}
break;
case 'updatePhoneCall':
if (is_object($update['update']['phone_call']) && isset($update['update']['phone_call']->madeline) && $update['update']['phone_call']->getCallState() === \danog\MadelineProto\VoIP::CALL_STATE_INCOMING) {
include('songs.php');

View File

@ -8,4 +8,4 @@ $songs = [
// 'Swingrowers - Butterfly' => 'inputc.raw',
'Postmodern Jukebox - Thrift Shop' => 'inputd.raw',
];
shuffle($songs);
for ($x = 0; $x < count($songs); $x++) { shuffle($songs); }