utility.presence: hang status
This commit is contained in:
parent
bf88b15d61
commit
5a967de4cd
1 changed files with 58 additions and 0 deletions
|
@ -97,6 +97,37 @@ const PRESENCE_TYPES = [
|
|||
"Competing in",
|
||||
];
|
||||
|
||||
const HANG_STATUS_TEXT = {
|
||||
chilling: "Chilling",
|
||||
gaming: "GAMING",
|
||||
focusing: "In the zone",
|
||||
brb: "Gonna BRB",
|
||||
eating: "Grubbin",
|
||||
"in-transit": "Wandering IRL",
|
||||
watching: "Watchin' stuff",
|
||||
};
|
||||
|
||||
const HANG_STATUS_ICONS = {
|
||||
chilling: "/assets/d5df7edf0b2f38954140.svg",
|
||||
gaming: "/assets/0c7aa94c8471f12c1583.svg",
|
||||
focusing: "/assets/5ba60eea3fdfa7b63f2e.svg",
|
||||
brb: "/assets/194dda5f6443bc84d703.svg",
|
||||
eating: "/assets/5f41131fa82e3a74fbf7.svg",
|
||||
"in-transit": "/assets/0cb37cec5b33d664373a.svg",
|
||||
watching: "/assets/b7832fa2d0b75e26e279.svg",
|
||||
};
|
||||
|
||||
(async () => {
|
||||
for (const key of Object.keys(HANG_STATUS_ICONS)) {
|
||||
const svg = await fetch(`https://discord.com${HANG_STATUS_ICONS[key]}`)
|
||||
.then((res) => res.arrayBuffer())
|
||||
.then((b) => Buffer.from(b));
|
||||
HANG_STATUS_ICONS[key] = await sharp(svg, {density: 2400})
|
||||
.resize(128)
|
||||
.toBuffer();
|
||||
}
|
||||
})();
|
||||
|
||||
const USER_FLAGS = [
|
||||
"STAFF",
|
||||
"PARTNER",
|
||||
|
@ -1692,6 +1723,33 @@ presence.callback = async function (msg, line) {
|
|||
embed.title = activity.state ?? "";
|
||||
}
|
||||
|
||||
embeds.push(embed);
|
||||
} else if (activity.type == 6) {
|
||||
const embed = {};
|
||||
|
||||
embed.title = "Hang Status";
|
||||
embed.description = `Right now I'm \u2013\n**${
|
||||
activity.state == "custom"
|
||||
? activity.details
|
||||
: HANG_STATUS_TEXT[activity.state]
|
||||
}**`;
|
||||
|
||||
if (activity.emoji) {
|
||||
embed.thumbnail = {
|
||||
url: `${EMOTE_BASE}${activity.emoji.id}${
|
||||
activity.emoji.animated ? ".gif" : ".png"
|
||||
}`,
|
||||
};
|
||||
} else {
|
||||
files.push({
|
||||
contents: HANG_STATUS_ICONS[activity.state],
|
||||
name: `${activity.state}.png`,
|
||||
});
|
||||
embed.thumbnail = {
|
||||
url: `attachment://${activity.state}.png`,
|
||||
};
|
||||
}
|
||||
|
||||
embeds.push(embed);
|
||||
} else {
|
||||
const embed = {
|
||||
|
|
Loading…
Reference in a new issue