mirror of
https://github.com/zyqunix/tools.git
synced 2025-07-06 14:30:31 +02:00
add discord status/activity yippe
This commit is contained in:
parent
4dc7824f7e
commit
11b3210dcc
4 changed files with 71 additions and 13 deletions
24
bio/lanyard.js
Normal file
24
bio/lanyard.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
lanyard({
|
||||
userId: "1201415921802170388",
|
||||
}).then(data => {
|
||||
const status = document.getElementById('status');
|
||||
const nameDiv = document.getElementById('name');
|
||||
const customStatus = data.activities.find(activity => activity.type === 4);
|
||||
|
||||
const statusColors = {
|
||||
online: "#23a55a",
|
||||
idle: "#f0b232",
|
||||
dnd: "#f23f43",
|
||||
offline: "#80848e"
|
||||
};
|
||||
|
||||
const borderColor = statusColors[data.discord_status] || offline;
|
||||
status.style.background = `${borderColor}`;
|
||||
|
||||
if (customStatus) {
|
||||
nameDiv.setAttribute("data-tooltip", customStatus.state);
|
||||
} else {
|
||||
nameDiv.setAttribute("data-tooltip", "No custom status");
|
||||
}
|
||||
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue