Skip to content

Instantly share code, notes, and snippets.

View ImSVTVN's full-sized avatar

SVTVN ImSVTVN

View GitHub Profile
@ImSVTVN
ImSVTVN / badge.php
Created March 25, 2018 03:10
Simple Discord Online Members Badge. Just a badge that shows how many online members are in your discord server.
<?php
$members = json_decode(file_get_contents('https://discordapp.com/api/guilds/GUILD_ID_HERE/widget.json'), true)['members'];
$membersCount = 1;
foreach ($members as $member) {
if ($member['status'] == 'online') {
$membersCount++;
}
}
?>