Merge pull request #541 from talvasconcelos/fix/streamlabsInv
fix streamalerts
This commit is contained in:
commit
7988e2c303
3 changed files with 7 additions and 5 deletions
|
|
@ -60,7 +60,7 @@ class Service(BaseModel):
|
|||
onchain: Optional[str]
|
||||
servicename: str # Currently, this will just always be "Streamlabs"
|
||||
authenticated: bool # Whether a token (see below) has been acquired yet
|
||||
token: Optional[int] # The token with which to authenticate requests
|
||||
token: Optional[str] # The token with which to authenticate requests
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: Row) -> "Service":
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
donationDialog: {
|
||||
show: false,
|
||||
data: {
|
||||
name: '',
|
||||
name: null,
|
||||
sats: '',
|
||||
message: ''
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ from starlette.responses import RedirectResponse
|
|||
|
||||
from lnbits.core.crud import get_user
|
||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||
from lnbits.extensions.satspay.models import CreateCharge
|
||||
from lnbits.extensions.streamalerts.models import (
|
||||
CreateDonation,
|
||||
CreateService,
|
||||
|
|
@ -113,17 +114,18 @@ async def api_create_donation(data: CreateDonation, request: Request):
|
|||
service_id = data.service
|
||||
service = await get_service(service_id)
|
||||
charge_details = await get_charge_details(service.id)
|
||||
name = data.name
|
||||
name = data.name if data.name else "Anonymous"
|
||||
|
||||
description = f"{sats} sats donation from {name} to {service.twitchuser}"
|
||||
charge = await create_charge(
|
||||
create_charge_data = CreateCharge(
|
||||
amount=sats,
|
||||
completelink=f"https://twitch.tv/{service.twitchuser}",
|
||||
completelinktext="Back to Stream!",
|
||||
webhook=webhook_base + "/streamalerts/api/v1/postdonation",
|
||||
description=description,
|
||||
**charge_details,
|
||||
**charge_details
|
||||
)
|
||||
charge = await create_charge(user=charge_details["user"], data=create_charge_data)
|
||||
await create_donation(
|
||||
id=charge.id,
|
||||
wallet=service.wallet,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue