diff --git a/apisnd.py b/apisnd.py index 986cf61..7c6ac8c 100644 --- a/apisnd.py +++ b/apisnd.py @@ -24,6 +24,19 @@ def apisender(): sh = os.popen(curl) sh0 = sh.read() + while True: + if 'Bid too low' in sh0: + print("ATENTION: Per byte bid cannot be below 50 millisatoshis per byte.\n") + url = 'https://api.blockstream.space/order' + message = input("\nInsert your Message: ") + 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 + sh = os.popen(curl) + sh0 = sh.read() + elif 'lightning_invoice' in sh0: + break + sh1 = str(sh0) shh = sh1.split(',') invoice = str(shh[6]) @@ -76,10 +89,22 @@ def apisenderFile(): message = input("\nInsert the path to the File: ") 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 - + curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "file=@' + message + '" ' + url sh = os.popen(curl) sh0 = sh.read() + while True: + if 'Bid too low' in sh0: + print("ATENTION: Per byte bid cannot be below 50 millisatoshis per byte.\n") + url = 'https://api.blockstream.space/order' + message = input("\nInsert the path to the File: ") + 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(curl) + sh0 = sh.read() + elif 'lightning_invoice' in sh0: + break + sh1 = str(sh0) shh = sh1.split(',') invoice = str(shh[6]) @@ -158,5 +183,3 @@ def donate(): menuB = (input("\033[1;32;40mSelect option: \033[0;37;40m")) if menuB == "A" or menuB == "a": devAddr() - -