You are viewing a single comment's thread from:

RE: LUV breakdown

in LUVHBIT Community7 months ago

Sorry for not seeing this earlier, I was focused on the connection, but the comment from @hannes-stoffel gave it away, the account that you are trying to read the balance for has never had any LUV in their account ever, so Hive-engine will not give an amount, not even 0.

I ran into that issue before as well, and had to make some exceptions for those cases, look from line 191 in Alivebot here to see the 2 exceptions that I added, https://github.com/flaxz/alivebot/blob/main/src/alivebot/alivebot.py

!ALIVE

Sort:  

the account that you are trying to read the balance for has never had any LUV in their account ever, so Hive-engine will not give an amount, not even 0.

oh, that is a good point, depending on how you access the wallet balance/stake this might be it.

I get around that problem by using the Wallet class (iirc the pizza bot does it this way as well, my source is mostly built on pizza bot):

    wallet_token_info = Wallet(user).get_token(TOKEN_NAME)

    if not wallet_token_info:
        liquid = 0
        stake = 0
    else:
        liquid = float(wallet_token_info['balance'])
        stake = float(wallet_token_info['stake'])

    to_Debug(f'User {user} has balance:{liquid} and stake:{stake}')

In worst case (either user or token not found) the object is empty and the first if triggers setting the variables to zero.

But does the hbit bot check balances? Does not need to, does it?

I get around that problem by using the Wallet class (iirc the pizza bot does it this way as well, my source is mostly built on pizza bot)

Maybe that was added to pizzabot after I forked it, alivebot is also based on that, when I ran into this issue I added an exception for no valid balances.

But does the hbit bot check balances?

I don't know, but I would think not.

!ALIVE

@hannes-stoffel! You Are Alive so I just staked 0.1 $ALIVE to your account on behalf of @ flaxz. (14/20)

The tip has been paid for by the We Are Alive Tribe through the earnings on @alive.chat, feel free to swing by our daily chat any time you want, plus you can win Hive Power (2x 50 HP) and Alive Power (2x 500 AP) delegations (4 weeks), and Ecency Points (4x 50 EP), in our chat every day.

I don't follow everything here, but I'll take a look, thanks. It'll be a few a week though...got some traveling coming up and computer less time ahead.

Termux for Android is a good mobile terminal that allows you to use SSH easily.

!BBH

Thanks for the tip. Could not find Termux in the playstore though. But it showed me Termius. Do you mean that one?

No, Termux can be installed from the Fdroid open source app store.

!BBH

@hannes-stoffel! Your Content Is Awesome so I just sent 1 $BBH (Bitcoin Backed Hive) to your account on behalf of @flaxz. (15/50)

@crrdlx! Your Content Is Awesome so I just sent 1 $BBH (Bitcoin Backed Hive) to your account on behalf of @flaxz. (27/50)