tidy up webhook
This commit is contained in:
parent
4a80f45e1e
commit
53e64bb1eb
|
@ -1,14 +1,22 @@
|
|||
<?php
|
||||
$debug = false;
|
||||
$input = file_get_contents("php://input");
|
||||
$tilderadio = json_decode($input, true);
|
||||
|
||||
$json = json_decode(file_get_contents('php://input'));
|
||||
if ($debug) {
|
||||
$timestamp = date("c");
|
||||
file_put_contents("$timestamp.json", $input);
|
||||
print_r($tilderadio);
|
||||
}
|
||||
|
||||
$msg = "";
|
||||
|
||||
if ($json->live->is_live)
|
||||
$msg .= "({$json->live->streamer_name}) ";
|
||||
if ($tilderadio["live"]["is_live"])
|
||||
$msg .= "({$tilderadio["live"]["streamer_name"]}) ";
|
||||
$msg .= "now playing: ";
|
||||
$msg .= $json->now_playing->song->text . " ";
|
||||
$msg .= "~~ {$json->listeners->current} listeners";
|
||||
$msg .= $tilderadio["now_playing"]["song"]["text"] . " ";
|
||||
$msg .= "~~ {$tilderadio["listeners"]["current"]} listeners";
|
||||
|
||||
echo $msg;
|
||||
file_put_contents(__DIR__."/../now_playing.txt", $msg);
|
||||
|
||||
|
|
Reference in New Issue