Split GetBalance to a core RetrieveBalance and the user command
This commit is contained in:
parent
2cb01954d4
commit
d5ab3b88f5
|
@ -89,12 +89,8 @@ for modulename in modulenames:
|
||||||
|
|
||||||
def GetBalance(link,cmd):
|
def GetBalance(link,cmd):
|
||||||
nick=link.user.nick
|
nick=link.user.nick
|
||||||
log_log("GetBalance: checking %s (%s)" % (link.identity(),str(link)))
|
|
||||||
try:
|
try:
|
||||||
balance = redis_hget("balances",link.identity())
|
balance = RetrieveBalance(link)
|
||||||
if balance == None:
|
|
||||||
balance = 0
|
|
||||||
balance = long(balance)
|
|
||||||
sbalance = AmountToString(balance)
|
sbalance = AmountToString(balance)
|
||||||
if balance < coinspecs.atomic_units:
|
if balance < coinspecs.atomic_units:
|
||||||
if balance == 0:
|
if balance == 0:
|
||||||
|
|
|
@ -212,6 +212,16 @@ def RetrieveTipbotBalance():
|
||||||
return
|
return
|
||||||
return balance, unlocked_balance
|
return balance, unlocked_balance
|
||||||
|
|
||||||
|
def RetrieveBalance(link):
|
||||||
|
try:
|
||||||
|
balance = redis_hget("balances",link.identity())
|
||||||
|
if balance == None:
|
||||||
|
balance = 0
|
||||||
|
return long(balance)
|
||||||
|
except Exception, e:
|
||||||
|
log_error('RetrieveBalance: exception: %s' % str(e))
|
||||||
|
raise
|
||||||
|
|
||||||
def IdentityFromString(link,s):
|
def IdentityFromString(link,s):
|
||||||
if s.find(':') == -1:
|
if s.find(':') == -1:
|
||||||
network = link.network.name
|
network = link.network.name
|
||||||
|
|
Loading…
Reference in New Issue