forked from PreMiD/Presences
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hypixel API • Reborn documentation Presence
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist/" | ||
} | ||
} |