print wallet address on low funds

This commit is contained in:
Karol Wypchlo 2020-11-27 16:58:37 +01:00
parent 9ea30d92f3
commit 443eacc844
2 changed files with 11 additions and 1 deletions

View File

@ -161,6 +161,14 @@ class siad:
def load_json(resp):
return json.loads(resp.decode("utf-8"))
@staticmethod
def get(endpoint):
if not setup_done:
setup()
resp = urllib.request.urlopen(api_endpoint + endpoint).read()
return siad.load_json(resp)
@staticmethod
def get_wallet():
if not setup_done:

View File

@ -64,7 +64,9 @@ async def check_funds():
# Send an alert if there is less than 1 allowance worth of money left.
if balance < allowance_funds:
message = "__Wallet balance running low!__ {}".format(balance_msg)
wallet_address_res = siad.get("/wallet/address")
wallet_msg = "Address: {}".format(wallet_address_res["address"])
message = "__Wallet balance running low!__ {} {}".format(balance_msg, wallet_msg)
return await send_msg(client, message, force_notify=True)
# Alert devs when only a fraction of the allowance is remaining.