Make badges for channels show which channel they are for

This commit is contained in:
Robert Miles 2018-07-08 13:04:21 -04:00
parent 32b362d928
commit e243111436
1 changed files with 1 additions and 1 deletions

View File

@ -6,7 +6,7 @@
$stats = json_decode(file_get_contents("https://tilde.chat/stats.json")) ?? array("channels"=>[]); $stats = json_decode(file_get_contents("https://tilde.chat/stats.json")) ?? array("channels"=>[]);
foreach ($stats->channels as $key=>$channel) { foreach ($stats->channels as $key=>$channel) {
if ($channel->name==$channel_name) { if ($channel->name==$channel_name) {
return "https://img.shields.io/badge/dynamic/json.svg?url=https://tilde.chat/stats.json&label=~chat&query=$.channels[$key].usercount&suffix=%20online"; return "https://img.shields.io/badge/dynamic/json.svg?url=https://tilde.chat/stats.json&label=~chat&query=$.channels[$key].usercount&suffix=%20online%20on%20{$channel_name}";
} }
} }
return "https://img.shields.io/badge/~chat-invalid%20channel-red.svg"; return "https://img.shields.io/badge/~chat-invalid%20channel-red.svg";