From d9b544f7af3dd39f291dcaa8fc087459c0b7006b Mon Sep 17 00:00:00 2001 From: nin0dev Date: Fri, 10 May 2024 18:02:26 -0400 Subject: [PATCH] Added presence --- index.html | 3 ++- index.js | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 index.js diff --git a/index.html b/index.html index a0a4e27..3c972b4 100644 --- a/index.html +++ b/index.html @@ -15,10 +15,11 @@
+ \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..8fce179 --- /dev/null +++ b/index.js @@ -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); +});