Created
February 24, 2020 22:38
-
-
Save sinancetinkaya/75c498c6fe67c1107a08d552bf99a41f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>repl.it</title> | |
<link href="style.css" rel="stylesheet" type="text/css" /> | |
<script | |
src="https://code.jquery.com/jquery-3.3.1.min.js" | |
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" | |
crossorigin="anonymous"></script> | |
</head> | |
<body> | |
<ul id="members"> | |
</ul> | |
<script> | |
$(document).ready( function() { | |
let url = "https://discordapp.com/api/guilds/150305025099300865/widget.json"; | |
let statuses = ["online", "idle"]; | |
$.getJSON(url, function(result) { | |
var members = ''; | |
$.each(result.members, function(index, member) { | |
if (statuses.includes(member.status)) { | |
if (member.hasOwnProperty("game")) { | |
member.status += '/ingame "' + member.game.name + '"'; | |
} | |
members += "<li>" + member.username + ": " + member.status + "</li>"; | |
} | |
}); | |
document.getElementById("members").innerHTML = members; | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment