Added lanyard presence
This commit is contained in:
parent
67b548470f
commit
40da75ff84
5 changed files with 73 additions and 2 deletions
BIN
game.png
Normal file
BIN
game.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 545 B |
33
index.html
33
index.html
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>HTML 5 Boilerplate</title>
|
<title>nin0dev</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://unpkg.com/98.css">
|
<link rel="stylesheet" href="https://unpkg.com/98.css">
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
|
@ -19,6 +19,10 @@
|
||||||
<h3>nin0dev <span style="font-size: 0.4em;">(he/him)</span></h3>
|
<h3>nin0dev <span style="font-size: 0.4em;">(he/him)</span></h3>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
<div id="presence" style="display: none; margin-bottom: 12px;">
|
||||||
|
<img src="game.png" id="presence-icon">
|
||||||
|
<p id="presence-content"></p>
|
||||||
|
</div>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>About me</legend>
|
<legend>About me</legend>
|
||||||
I'm a Canadian self-taught software developer that makes useless things in Python, HTML, JavaScript, and Kotlin.
|
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
|
yeah that's it
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<br/>
|
<br/>
|
||||||
|
<fieldset>
|
||||||
|
<legend>My projects</legend>
|
||||||
|
<ul style="margin-top: 5px; margin-bottom: 5px; padding-left: 20px;">
|
||||||
|
<li>
|
||||||
|
VendroidEnhanced: A Discord client for Android that loads the mobile website and injects Vencord.
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/VendroidEnhanced/Vendroid">GitHub repo</a></li>
|
||||||
|
<li>Actively maintained</li>
|
||||||
|
<li>Fork of <a href="https://github.com/Vencord/Vendroid">Vencord/Vendroid</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
website: The website you're currently viewing
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/nin0-dev/website">GitHub repo</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
nin0-bot: A generic kitchen sink bot with basic moderation features
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/nin0-dev/nin0-bot">GitHub repo</a></li>
|
||||||
|
<li>In maintenance mode, plan to resume development soon</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</fieldset>
|
||||||
|
</br>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Reach out!</legend>
|
<legend>Reach out!</legend>
|
||||||
<ul style="margin-top: 5px; margin-bottom: 5px; padding-left: 20px;">
|
<ul style="margin-top: 5px; margin-bottom: 5px; padding-left: 20px;">
|
||||||
|
|
27
index.js
27
index.js
|
@ -1,4 +1,4 @@
|
||||||
shouldLog = false;
|
let shouldLog = false;
|
||||||
function log(content) {
|
function log(content) {
|
||||||
if (shouldLog) console.log(content);
|
if (shouldLog) console.log(content);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,31 @@ function onUpdate(data) {
|
||||||
pfp.style.borderColor = "var(--offline-color)";
|
pfp.style.borderColor = "var(--offline-color)";
|
||||||
break;
|
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)
|
LanyardWrapper.connectWebSocket("886685857560539176", onUpdate)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
BIN
music.png
Normal file
BIN
music.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 641 B |
15
style.css
15
style.css
|
@ -48,4 +48,19 @@ fieldset {
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
color: cornflowerblue;
|
color: cornflowerblue;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
#presence img {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
#presence-content {
|
||||||
|
margin-top: auto;
|
||||||
|
margin-bottom: auto;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
#presence {
|
||||||
|
display: flex;
|
||||||
}
|
}
|
Loading…
Reference in a new issue