-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c623ae5
commit e4526f0
Showing
2 changed files
with
116 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,42 @@ | ||
{ | ||
"$schema": "https://schemas.premid.app/metadata/1.10", | ||
"author": { | ||
"id": "479492889601114113", | ||
"name": "koolkev246" | ||
}, | ||
"service": "Stake.us", | ||
"description": { | ||
"en": "Stake.us offers an the best social casino games online, all available to play for fun & free. Enjoy free games, from slots to blackjack, roulette & more." | ||
}, | ||
"url": "stake.us", | ||
"version": "1.0.0", | ||
"logo": "https://i.imgur.com/X9jCmBM.jpeg", | ||
"thumbnail": "https://i.imgur.com/lobHZwr.jpeg", | ||
"color": "#1a2c3a", | ||
"category": "games", | ||
"tags": [ | ||
"stake", | ||
"casino", | ||
"gambling" | ||
], | ||
"settings": [ | ||
{ | ||
"id": "showBal", | ||
"title": "Display Balance", | ||
"icon": "fad fa-coins", | ||
"value": true | ||
}, | ||
{ | ||
"id": "showTimestamp", | ||
"title": "Display Timestamp", | ||
"icon": "fad fa-clock", | ||
"value": true | ||
}, | ||
{ | ||
"id": "showCurrentGame", | ||
"title": "Display Current Game", | ||
"icon": "fad fa-slot-machine", | ||
"value": true | ||
} | ||
] | ||
} |
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,74 @@ | ||
const presence = new Presence({ | ||
clientId: "1231098376741982349", | ||
}), | ||
browsingTimestamp = Math.floor(Date.now() / 1000); | ||
|
||
presence.on("UpdateData", async () => { | ||
const [showBal, showTimestamp, showCurrentGame] = await Promise.all([ | ||
presence.getSetting<boolean>("showBal"), | ||
presence.getSetting<boolean>("showTimestamp"), | ||
presence.getSetting<boolean>("showCurrentGame"), | ||
]), | ||
presenceData: PresenceData = { | ||
largeImageKey: "https://i.imgur.com/9jDaQ1b.png", | ||
}, | ||
{ pathname, search } = window.location; | ||
|
||
if (showTimestamp) presenceData.startTimestamp = browsingTimestamp; | ||
|
||
if (pathname.includes("casino") && !pathname.includes("games")) { | ||
if (pathname.includes("group")) { | ||
presenceData.state = `Browsing ${pathname | ||
.split("/group/") | ||
.pop() | ||
.replaceAll("-", " ") | ||
.replace(/(^\w{1})|(\s+\w{1})/g, letter => letter.toUpperCase())}...`; | ||
} else presenceData.state = "Browsing Casino..."; | ||
} else if (pathname.includes("games")) { | ||
if (showCurrentGame) { | ||
presenceData.state = `Playing ${document | ||
.querySelector("div.title-wrap > h1") | ||
.textContent.trim()}`; | ||
} | ||
} else presenceData.state = "Browsing..."; | ||
|
||
if (showBal) { | ||
const balanceElement = document.querySelector( | ||
"div.currency > span.content > span" | ||
), | ||
currencyElement = document.querySelector( | ||
"div.currency > span.variant-subtle" | ||
); | ||
let balance = "Unknown", | ||
currency = "Currency"; | ||
if (balanceElement) | ||
balance = balanceElement.textContent.trim().replace(" ", " "); | ||
|
||
if (currencyElement) { | ||
if (currencyElement.getAttribute("title") === "sweeps") | ||
currency = "Stake Cash"; | ||
else currency = "Gold Coins"; | ||
} | ||
|
||
if (pathname.includes("games")) | ||
presenceData.details = "Balance: (In Use In Game)"; | ||
else if (!pathname.includes("games") && balance.includes(",")) | ||
presenceData.details = `Balance: ${balance} (${currency})`; | ||
else presenceData.details = `Balance: ${balance} ${currency}`; | ||
|
||
if (search.includes("modal=wallet")) | ||
presenceData.state = "Checking Wallet..."; | ||
else if (search.includes("modal=vault")) | ||
presenceData.state = "Checking Vault..."; | ||
else if (search.includes("modal=vip")) | ||
presenceData.state = "Checking VIP Progress..."; | ||
else if (search.includes("modal=user")) | ||
presenceData.state = "Checking Statistics..."; | ||
else if (pathname.includes("/transactions/")) | ||
presenceData.state = "Viewing Transactions..."; | ||
else if (pathname.includes("/settings/")) | ||
presenceData.state = "Adjusting Settings..."; | ||
} | ||
|
||
presence.setActivity(presenceData); | ||
}); |