From 40da75ff848440bf1535a603e53a3800fd96c8b5 Mon Sep 17 00:00:00 2001 From: nin0dev Date: Sat, 11 May 2024 03:19:40 -0400 Subject: [PATCH] Added lanyard presence --- game.png | Bin 0 -> 545 bytes index.html | 33 ++++++++++++++++++++++++++++++++- index.js | 27 ++++++++++++++++++++++++++- music.png | Bin 0 -> 641 bytes style.css | 15 +++++++++++++++ 5 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 game.png create mode 100644 music.png diff --git a/game.png b/game.png new file mode 100644 index 0000000000000000000000000000000000000000..b91468c8a79c6e9f1997d6abb2a22bcf4a19e299 GIT binary patch literal 545 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvmUKs7M+SzC{oH>NSwWJ?9znhg z3{`3j3=J&|48MRv4KElNN(~qoUL`OvSj}Ky5HFasE6@fgAs65i;tEpG(D48Ne<0() zfddT<3_xZB0|SW9@L$-E(Gy5BmIV0)GdMiEkp|)p1!W^kJzLb zbd7hoWp)FFK6|=2hG?9Rz2JE2kbwZ}gNBaRVFydSkF4EV#jy6ly;eB~nHQ`oaSN`L zhVNYa-gi;`zjJC|X1iYwPwqKcmwf0+>YOCwwx1GyQZv~i7}vP16K9oit#nAy;^%#! z@oJZwL(9Yp6OInIc}mf&IVI1RtQDEZ@+RgvvxQCZ^LzVtX_P409r(BKg15KD{&wwq zt}kp3?)$c<@51j7yOy4?ZJZigX7r?YCSzMq=(SpJha=&ZtJiE)Jo8J@debT0royXE ztKY~hYT;yxdfKCLP+>u+&Z4v5=Wp_=wCHoV?dCA`jr - HTML 5 Boilerplate + nin0dev @@ -19,6 +19,10 @@

nin0dev (he/him)


+
About me I'm a Canadian self-taught software developer that makes useless things in Python, HTML, JavaScript, and Kotlin. @@ -26,6 +30,33 @@ yeah that's it

+
+ My projects +
    +
  • + VendroidEnhanced: A Discord client for Android that loads the mobile website and injects Vencord. + +
  • +
  • + website: The website you're currently viewing + +
  • +
  • + nin0-bot: A generic kitchen sink bot with basic moderation features +
      +
    • GitHub repo
    • +
    • In maintenance mode, plan to resume development soon
    • +
    +
  • +
+
+
Reach out!
    diff --git a/index.js b/index.js index c36a4a5..128c331 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -shouldLog = false; +let shouldLog = false; function log(content) { if (shouldLog) console.log(content); } @@ -20,6 +20,31 @@ function onUpdate(data) { pfp.style.borderColor = "var(--offline-color)"; break; } + // set presence + log(data["activities"]) + let listening = false + let content = "" + data["activities"].forEach(presence => { + if(presence["application_id"] == "463151177836658699" && presence["assets"]["small_text"] != "Paused") { // premid + listening = true + artist = presence["state"].substring(0, presence["state"].indexOf(" -")) + if (artist == "") { + artist = presence["state"] + } + content = `Listening to ${presence["details"]} - ${artist}` + } + if(presence["application_id"] == "1108588077900898414") { // vencord lastfm + listening = true + content = `Listening to ${presence["details"]} - ${presence["state"]}` + } + if(presence["type"] == 0 && presence["application_id"] != "463151177836658699" && presence["application_id"] != "1108588077900898414") { // generic playing status that isn't vencord lastfm or premid + listening = false + content = `Playing ${presence["name"]}` + } + }); + document.getElementById("presence").style.display = content == "" ? "none": "flex" + document.getElementById("presence-content").innerText = content + document.getElementById("presence-icon").src = listening ? "music.png" : "game.png" } LanyardWrapper.connectWebSocket("886685857560539176", onUpdate) .catch(err => { diff --git a/music.png b/music.png new file mode 100644 index 0000000000000000000000000000000000000000..fc07a9dea1c1cc5ef206eb76d3b2a971d0ae5674 GIT binary patch literal 641 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDB3?!H8JlO)ISkfJR9T^xl_H+M9WCijSl0AZa z85pY67#JE_7#My5g&JNkFq8r{zDi(Vu$sZZAYL$MSD+10LL$H?#1%*bK|@2s|NjgJ z4jf?k4+0GT8IpJW*#VSbED7=pW^j0RBMrn!@^*J&OHA8Q3*@kuc>21sKVlJPRFasQ z@#`i~I?~g{F~s8Z+AH39hZO|a63%e;q^`VO zf=%Y3kr86^>*ScX3EY?!_GY`=R`&u0j^9ojw0*rdaX%6`qS&#YA>sDTc};~|#O@h? z;R!m+axLeQ1yg0vJVkG2mh|}t{8AS_nRRfR?n;%4dV1TfwE0@} zZ!K8oC$8~8X4;c2AqN@-bPik&SFmi5ef)HnNbrSC8V4SD3kWcC`0sx*v0##f!U7LA zNoJ1MqRKyiC8!+Q5%s<}!CHt#W;Mr=%e4ph{#vo5?x0mD