print wallet address on low funds
This commit is contained in:
parent
9ea30d92f3
commit
443eacc844
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
Reference in New Issue