Added presence
This commit is contained in:
parent
e1c93f4ce3
commit
d9b544f7af
2 changed files with 25 additions and 1 deletions
|
@ -15,10 +15,11 @@
|
||||||
<div class="window-body">
|
<div class="window-body">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<img src="logo.png" alt="the nin0dev logo" id="pfp">
|
<img src="logo.png" alt="the nin0dev logo" id="pfp">
|
||||||
<h3>nin0dev</h3>
|
<h3>nin0dev <span style="font-size: 0.4em;">(he/him)</span></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/lanyard-wrapper/dist/index.browser.js"></script>
|
||||||
<script src="index.js"></script>
|
<script src="index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
23
index.js
Normal file
23
index.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
function onUpdate(data) {
|
||||||
|
console.log(data)
|
||||||
|
// set status
|
||||||
|
const pfp = document.getElementById("pfp");
|
||||||
|
switch(data["discord_status"]) {
|
||||||
|
case "online":
|
||||||
|
pfp.style.borderColor = "var(--online-color)";
|
||||||
|
break;
|
||||||
|
case "idle":
|
||||||
|
pfp.style.borderColor = "var(--idle-color)";
|
||||||
|
break;
|
||||||
|
case "dnd":
|
||||||
|
pfp.style.borderColor = "var(--dnd-color)";
|
||||||
|
break;
|
||||||
|
case "offline":
|
||||||
|
pfp.style.borderColor = "var(--offline-color)";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LanyardWrapper.connectWebSocket("886685857560539176", onUpdate)
|
||||||
|
.catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
Loading…
Reference in a new issue