Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions websites/D/Duel.com/metadata.json
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
},
Comment thread
Bas950 marked this conversation as resolved.
{
"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
}
]
}
85 changes: 85 additions & 0 deletions websites/D/Duel.com/presence.ts
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)
})
Loading