-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(Duel): add activity #10679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat(Duel): add activity #10679
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
151dec2
Create placeholder
Vormixy acbfe9b
Add files via upload
Vormixy c3b5b84
Delete websites/D/Duel.com/placeholder
Vormixy a17dc8d
Create plac.txt
Vormixy 0dacb50
Delete websites/D/Duel.com/dist/plac.txt
Vormixy d2564d8
Create aaa.txt
Vormixy 075ae51
Add files via upload
Vormixy 5da1a66
Delete websites/D/Duel.com/dist/aaa.txt
Vormixy 29720e1
Update presence.ts
Vormixy 23d256c
Update logo URL in metadata.json for Duel.com
Vormixy fd259a8
Update presence.ts
Vormixy 429c636
Update metadata.json
Vormixy e891205
Update logo URL in metadata.json
Vormixy 007def0
Update metadata.json
Vormixy 1002616
Update presence.ts
Vormixy 0f2c84a
Update logo URL in metadata.json
Vormixy 0ba67e0
Update metadata.json
Vormixy 4c14de8
Update presence.ts
Vormixy e3b26dc
Delete websites/D/Duel.com/dist/metadata.json
Vormixy 75cfdbe
Delete websites/D/Duel.com/dist/presence.js
Vormixy bfe4304
Delete websites/D/Duel.com/tsconfig.json
Vormixy c3b6664
Update metadata.json
Vormixy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,58 @@ | ||
| { | ||
| "$schema": "https://schemas.premid.app/metadata/1.16", | ||
| "apiVersion": 1, | ||
| "author": { | ||
| "id": "1406771921999233068", | ||
| "name": "vormixy4" | ||
| }, | ||
| "service": "Duel.com", | ||
| "description": { | ||
| "en": "Duel.com is a 100% RTP crypto casino and sportsbook that offers over 5,000 games from top providers, including slots, table games, and live dealer options." | ||
| }, | ||
| "url": "duel.com", | ||
| "regExp": "^https?[:][/][/]([a-z0-9-]+[.])*duel[.]com[/]", | ||
| "version": "1.0.0", | ||
| "logo": "https://i.imgur.com/vc9ErET.png", | ||
| "thumbnail": "https://duel.com/assets/header-md-6tXH1jdN.webp", | ||
| "color": "#1a2c4a", | ||
| "category": "games", | ||
| "tags": [ | ||
| "casino", | ||
| "blackjack", | ||
| "crash", | ||
| "dice", | ||
| "gambling", | ||
| "duel", | ||
| "slots", | ||
| "plinko", | ||
| "keno", | ||
| "roulette", | ||
| "poker" | ||
| ], | ||
| "settings": [ | ||
| { | ||
| "id": "showBal", | ||
| "title": "Display Balance", | ||
| "icon": "fad fa-coins", | ||
| "value": false | ||
| }, | ||
| { | ||
| "id": "showTimestamp", | ||
| "title": "Display Timestamp", | ||
| "icon": "fad fa-clock", | ||
| "value": true | ||
| }, | ||
| { | ||
| "id": "showCurrentGame", | ||
| "title": "Display Current Game", | ||
| "icon": "fad fa-slot-machine", | ||
| "value": true | ||
| }, | ||
| { | ||
| "id": "showGameProvider", | ||
| "title": "Display Game Provider", | ||
| "icon": "fad fa-provider", | ||
| "value": true | ||
| } | ||
| ] | ||
| } | ||
This file contains hidden or 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,85 @@ | ||
| const presence = new Presence({ | ||
| clientId: '1492950461186314472', | ||
| }) | ||
| const browsingTimestamp = Math.floor(Date.now() / 1000) | ||
|
|
||
| presence.on('UpdateData', async () => { | ||
| const [showBal, showTimestamp, showCurrentGame, showGameProvider] = await Promise.all([ | ||
| presence.getSetting<boolean>('showBal'), | ||
| presence.getSetting<boolean>('showTimestamp'), | ||
| presence.getSetting<boolean>('showCurrentGame'), | ||
| presence.getSetting<boolean>('showGameProvider'), | ||
| ]) | ||
|
|
||
| const presenceData: PresenceData = { | ||
| largeImageKey: 'https://i.imgur.com/vc9ErETg.png', | ||
| details: 'duel.com', | ||
| } | ||
|
|
||
| presenceData.name = 'Duel.com | Crypto Casino' | ||
|
|
||
| const { pathname } = document.location | ||
| const originals = ['blackjack', 'dice', 'crash', 'plinko', 'mines', 'beef', 'keno', 'castle-roulette', 'video-poker'] | ||
| const toTitleCase = (str: string) => str.replace(/\b\w/g, l => l.toUpperCase()) | ||
| const currentOriginal = originals.find(game => pathname === `/${game}`) | ||
|
|
||
| if (showTimestamp) | ||
| presenceData.startTimestamp = browsingTimestamp | ||
|
|
||
| if (currentOriginal || pathname.includes('/casino/provably-fair/')) { | ||
| const name = currentOriginal | ||
| ? toTitleCase(currentOriginal) | ||
| : toTitleCase(pathname.split('/casino/provably-fair/').pop()?.replaceAll('-', ' ') ?? 'unknown game') | ||
| presenceData.state = `Playing "${name}" by Duel` | ||
| } | ||
| else if (pathname.includes('/casino/games/')) { | ||
| if (showCurrentGame) { | ||
| const gameSlug = pathname.split('/casino/games/').pop() ?? '' | ||
| const parts = gameSlug.split('_') | ||
| const gameProvider = toTitleCase(parts.slice(0, 2).join(' ')) | ||
| const gameName = toTitleCase(parts.slice(2).join(' ')) | ||
| presenceData.state = `Playing "${gameName}"${showGameProvider ? ` by ${gameProvider}` : ''}` | ||
| } | ||
| } | ||
| else if (pathname.includes('/casino')) { | ||
| if (pathname.includes('/category/')) { | ||
| presenceData.state = `Browsing ${pathname | ||
| .split('/category/') | ||
| .pop() | ||
| ?.replaceAll('-', ' ') | ||
| .replace(/\b\w/g, l => l.toUpperCase())}...` | ||
| } | ||
| else { | ||
| presenceData.state = 'Browsing Casino...' | ||
| } | ||
| } | ||
| else if (pathname.includes('sports')) { | ||
| presenceData.state = 'Browsing Sports...' | ||
| } | ||
|
|
||
| if (showBal) { | ||
| const currencyContainer = document.querySelector('[data-testid="currency-value"]') | ||
| const balanceText = Array.from(currencyContainer?.querySelectorAll('span') ?? []) | ||
| .map(s => s.textContent?.trim()) | ||
| .filter(Boolean) | ||
| .join('') ?? 'Unknown' | ||
|
|
||
| const isCrypto = /^[0-9.]+$/.test(balanceText) | ||
| const isUSD = balanceText.includes('$') | ||
|
|
||
| if (pathname.includes('/casino/games/') || pathname.includes('/casino/provably-fair/')) | ||
| presenceData.details = `Balance: (In Play)` | ||
| else if (isCrypto) | ||
| presenceData.details = `Balance: ${balanceText} (Crypto)` | ||
| else if (isUSD) | ||
| presenceData.details = `Balance: ${balanceText} USD` | ||
| else | ||
| presenceData.details = `Balance: ${balanceText}` | ||
| } | ||
| else { | ||
| presenceData.details = 'Balance: Hidden' | ||
| } | ||
|
|
||
| presenceData.stateUrl = document.location.href | ||
| presence.setActivity(presenceData) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.