From b4557e75cee59933ddc4b99db9fad76644d01438 Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Tue, 26 May 2020 16:03:55 -0300 Subject: [PATCH] Fixes and Donation QRCode Added input to insert amount when paying a broadcast Added Donation Def to get support --- apisnd.py | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/apisnd.py b/apisnd.py index 095af3e..683789c 100644 --- a/apisnd.py +++ b/apisnd.py @@ -1,5 +1,7 @@ import os import qrcode +import requests +import time as t def apisender(): qr = qrcode.QRCode( @@ -11,8 +13,10 @@ def apisender(): url = 'https://api.blockstream.space/order' message = input("\nInsert your Message: ") sentby = "... Message sent from PyBlock." + print("ATENTION: Minimum amount for sending a text is 5000 MSats") + amountmsat = input("\nInsert the amount in MSats: ") + curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "message=' + message + sentby + '" ' + url - curl = 'curl -F "bid=10000" -F ' + ' "message=' + message + sentby + '" ' + url sh = os.popen(str(curl)).read() shh = sh.split(',') invoice = str(shh[6]) @@ -47,7 +51,9 @@ def apisender(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln + "\n") - print(cln) + t.sleep(50) + devAddr() + def apisenderFile(): qr = qrcode.QRCode( @@ -58,8 +64,9 @@ def apisenderFile(): ) url = 'https://api.blockstream.space/order' message = input("\nInsert the path to the File: ") - - curl = 'curl -F "bid=50000" -F ' + ' "file=@' + message + '" ' + url + print("ATENTION: Minimum amount for sending a File is 50000 MSats") + amountmsat = input("\nInsert the amount in MSats: ") + curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "file=@' + message + '" ' + url sh = os.popen(str(curl)).read() shh = sh.split(',') invoice = str(shh[6]) @@ -94,6 +101,32 @@ def apisenderFile(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln) - print(cln) + t.sleep(50) + devAddr() +def devAddr(): + qr = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=10, + border=4, + ) + print("\n\t\t\033[1;33;44mGive us some love and \033[1;31;44mDONATE\033[1;33;44m us! We will appreciate it. This will be a boost to continue this beautiful project! \033[0;37;40m") + url = 'https://api.tippin.me/v1/public/addinvoice/royalfield370' + response = requests.get(url) + responseB = str(response.text) + responseC = responseB + lnreq = responseC.split(',') + lnbc1 = lnreq[1] + lnbc1S = str(lnbc1) + lnbc1R = lnbc1S.split(':') + lnbc1W = lnbc1R[1] + ln = str(lnbc1W) + ln1 = ln.strip('"') + print("\033[1;30;47m") + qr.add_data(ln1) + qr.print_ascii() + print("\033[0;37;40m") + print("LND Invoice: " + ln1) +