summaryrefslogtreecommitdiffstats
path: root/scripts/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/index.js')
-rw-r--r--scripts/index.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/index.js b/scripts/index.js
new file mode 100644
index 0000000..a9ddf93
--- /dev/null
+++ b/scripts/index.js
@@ -0,0 +1,30 @@
+function fetchDiscordStatus(userId) {
+ const API_URL = `https://api.lanyard.rest/v1/users/${userId}`;
+
+ fetch(API_URL)
+ .then(response => response.json())
+ .then(data => {
+ const discordStatus = data.data.discord_status;
+
+ const statusColors = {
+ online: "#43b581",
+ idle: "#faa61a",
+ dnd: "#f04747",
+ offline: "#747f8d",
+ };
+
+ const statusText = {
+ online: "Online",
+ idle: "Idle",
+ dnd: "Do Not Disturb",
+ offline: "Offline",
+ };
+
+ const statusSection = document.getElementById(`discord-status`);
+ const statusTextElement = statusSection.querySelector(".status-text");
+
+ statusSection.style.backgroundColor = statusColors[discordStatus];
+ statusTextElement.textContent = "Currently: " + statusText[discordStatus];
+ })
+ .catch(error => console.error("Error fetching Discord status:", error));
+ } \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage