diff --git a/websites/H/Hypixel API Reborn/dist/metadata.json b/websites/H/Hypixel API Reborn/dist/metadata.json new file mode 100644 index 000000000000..8e158d765f56 --- /dev/null +++ b/websites/H/Hypixel API Reborn/dist/metadata.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.0", + "author": { + "name": "StavZDev", + "id": "291568379423096832" + }, + "service": "Hypixel API Reborn", + "description": { + "en": "Hypixel API • Reborn is the only Hypixel API wrapper for Node.js/Typescript with intellisense support.", + "ru": "Hypixel API • Reborn - единственный парсер Hypixel API для Node.js/Typescript с поддержкой intellisense." + }, + "url": "hypixel.stavzdev.xyz", + "version": "1.0.0", + "logo": "https://i.imgur.com/eQzO2nG.png", + "thumbnail": "https://i.imgur.com/9BpoEmx.png", + "color": "#ff8c00", + "tags": [ + "development", + "other", + "hypixel-api-reborn", + "programming" + ], + "category": "other" +} \ No newline at end of file diff --git a/websites/H/Hypixel API Reborn/presence.ts b/websites/H/Hypixel API Reborn/presence.ts new file mode 100644 index 000000000000..c3dca1b70940 --- /dev/null +++ b/websites/H/Hypixel API Reborn/presence.ts @@ -0,0 +1,31 @@ +var presence = new Presence({ + clientId: "800651916345999360" +}); + +presence.on("UpdateData", () => { + let route = document.location.hash.split("/"); + + let data: PresenceData = { + largeImageKey: "logo", + }; + + if (route.length === 1 || route[1] === "") { + data.details = "Browsing the main page..."; + } else if (route[1] === "docs") { + data.smallImageKey = route[2]; + data.smallImageText = `${route[2].replace(/^[a-z]/i, (c) => c.toUpperCase())} - ${Number(route[3][0]) ? `v${route[3]}` : `${route[3]}`}`; + + if (route[4].startsWith("search?q=")) { + data.details = "Searching for:"; + data.state = route[4].slice(9); + } else if (route[4] === "general") { + data.details = "Viewing:"; + data.state = route[5] === "faq" ? route[5].toUpperCase() : `${route[5].replace(/^[a-z]/i, (c) => c.toUpperCase())}`; + } else { + data.details = `Looking for a${(route[5].split("?scrollTo=")[1] && route[5].split("?scrollTo=")[1].startsWith("e-")) || route[4] === "examples" ? "n" : ""} ${route[5].split("?scrollTo=")[1] && route[5].split("?scrollTo=")[1].startsWith("e-") ? "event" : `${route[4].endsWith("s") && route[4] !== "class" ? route[4].substring(0, route[4].length - 1) : route[4].replace(/^[a-z]/i, (c) => c.toUpperCase())}`}`; + data.state = `${route[5].split("?scrollTo=")[0]}${route[5].split("?scrollTo=")[1] ? `#${route[5].split("?scrollTo=")[1][1] === "-" ? route[5].split("?scrollTo=")[1].slice(2) : route[5].split("?scrollTo=")[1]}` : ""}`; + } + } + + presence.setActivity(data); +}); diff --git a/websites/H/Hypixel API Reborn/tsconfig.json b/websites/H/Hypixel API Reborn/tsconfig.json new file mode 100644 index 000000000000..8c4602ed86e2 --- /dev/null +++ b/websites/H/Hypixel API Reborn/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist/" + } +}