Skip to content

Commit

Permalink
fix(meow.camera): fixed stats, added local time (#8314)
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureToast authored Apr 29, 2024
1 parent 15dd0e9 commit 5ebb115
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion websites/M/meow.camera/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"matches": [
"*://meow.camera/*"
],
"version": "1.0.5",
"version": "1.0.6",
"logo": "https://cdn.rcd.gg/PreMiD/websites/M/meow.camera/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/M/meow.camera/assets/thumbnail.jpg",
"color": "#000000",
Expand Down
30 changes: 18 additions & 12 deletions websites/M/meow.camera/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,24 @@ presence.on("UpdateData", async () => {
});

function getStats(): string {
let stats = "";
const snack = document.querySelector("[title='Snack stock']"),
kibble = document.querySelector("[title='Kibble stock']"),
temp = document.querySelector("[title='Feeder temperature']");

if (!snack || !kibble || !temp) return stats;

stats = `🍪: ${snack.textContent === "" ? "🚫" : snack.textContent} | 🍿: ${
kibble.textContent === "" ? "🚫" : kibble.textContent
} | 🌡️: ${temp.textContent === "" ? "🚫" : temp.textContent} `;

return stats;
const stats: string[] = [],
time = document.querySelector(".time"),
snack = document.querySelector("[title='Snack stock']"),
kibble = document.querySelector("[title='Kibble stock']");

if (time) {
const timeArray: string[] = time.textContent.split(":");
let timeString = `🕒: ${timeArray[1]}:${timeArray[2]}`;
if (timeArray[timeArray.length - 1].includes("PM")) timeString += " PM";
else if (timeArray[timeArray.length - 1].includes("AM"))
timeString += " AM";

stats.push(timeString);
}
if (snack) stats.push(`🍪: ${snack.textContent}`);
if (kibble) stats.push(`🍚: ${kibble.textContent}`);

return stats.join(" | ");
}

function setTimestamps(
Expand Down

0 comments on commit 5ebb115

Please sign in to comment.