mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-19 12:01:12 +02:00
Satsdice working
This commit is contained in:
@@ -37,7 +37,16 @@ class satsdiceLink(BaseModel):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def lnurlpay_metadata(self) -> LnurlPayMetadata:
|
def lnurlpay_metadata(self) -> LnurlPayMetadata:
|
||||||
return LnurlPayMetadata(json.dumps([["text/plain", self.title]]))
|
return LnurlPayMetadata(
|
||||||
|
json.dumps(
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"text/plain",
|
||||||
|
f"{self.title} (Chance: {self.chance}%, Multiplier: {self.multiplier})",
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def success_action(self, payment_hash: str, req: Request) -> Optional[Dict]:
|
def success_action(self, payment_hash: str, req: Request) -> Optional[Dict]:
|
||||||
url = req.url_for(
|
url = req.url_for(
|
||||||
|
@@ -91,14 +91,13 @@ async def displaywin(
|
|||||||
HTTPStatus.NOT_FOUND, "satsdice link does not exist."
|
HTTPStatus.NOT_FOUND, "satsdice link does not exist."
|
||||||
)
|
)
|
||||||
if payment.pending == 1:
|
if payment.pending == 1:
|
||||||
print("cunt")
|
|
||||||
return satsdice_renderer().TemplateResponse(
|
return satsdice_renderer().TemplateResponse(
|
||||||
"satsdice/error.html",
|
"satsdice/error.html",
|
||||||
{
|
{
|
||||||
"request": request,
|
"request": request,
|
||||||
"link": satsdicelink.id,
|
"link": satsdicelink.id,
|
||||||
"paid": False,
|
"paid": False,
|
||||||
"lost": False,
|
"lost": True,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -115,7 +114,12 @@ async def displaywin(
|
|||||||
"lost": True,
|
"lost": True,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
rand = random.randint(0, 100)
|
rand1 = random.randint(0, 100)
|
||||||
|
rand2 = random.randint(0, 100)
|
||||||
|
rand3 = random.randint(0, 100)
|
||||||
|
rand4 = random.randint(0, 100)
|
||||||
|
rand = (rand1 + rand2 + rand3 + rand4) / 4
|
||||||
|
print(rand)
|
||||||
chance = satsdicelink.chance
|
chance = satsdicelink.chance
|
||||||
if rand > chance:
|
if rand > chance:
|
||||||
await update_satsdice_payment(payment_hash, lost=1)
|
await update_satsdice_payment(payment_hash, lost=1)
|
||||||
|
Reference in New Issue
Block a user