mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
addbalance now uses human friendly amounts
This commit is contained in:
parent
74c01f9bce
commit
8007d6c7e3
1 changed files with 7 additions and 6 deletions
13
tipbot.py
13
tipbot.py
|
@ -111,20 +111,21 @@ def AddBalance(nick,chan,cmd):
|
||||||
anick = nick
|
anick = nick
|
||||||
amount = GetParam(cmd,1)
|
amount = GetParam(cmd,1)
|
||||||
if not amount:
|
if not amount:
|
||||||
SendTo(sendto, 'usage: !addbalance <atomicunits> or !addbalance <nick> <atomicunits>')
|
SendTo(sendto, 'usage: !addbalance [<nick>] <amount>')
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
units = long(amount)
|
units = long(float(amount)*coinspecs.atomic_units)
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
log_error('AddBalance: error converting amount: %s' % str(e))
|
log_error('AddBalance: invalid amount: %s' % str(e))
|
||||||
SendTo(sendto, 'usage: !addbalance <atomicunits> or !addbalance <nick> <atomicunits>')
|
SendTo(sendto, 'usage: !addbalance [<nick>] <amount>')
|
||||||
return
|
return
|
||||||
log_info("AddBalance: Adding %s to %s's balance" % (AmountToString(amount),anick))
|
log_info("AddBalance: Adding %s to %s's balance" % (AmountToString(units),anick))
|
||||||
try:
|
try:
|
||||||
balance = redis_hincrby("balances",anick,amount)
|
balance = redis_hincrby("balances",anick,units)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log_error('AddBalance: exception: %s' % str(e))
|
log_error('AddBalance: exception: %s' % str(e))
|
||||||
SendTo(sendto, "An error has occured")
|
SendTo(sendto, "An error has occured")
|
||||||
|
SendTo(sendto,"%s's bvalance is now %s" % (anick,AmountToString(balance)))
|
||||||
|
|
||||||
def ScanWho(nick,chan,cmd):
|
def ScanWho(nick,chan,cmd):
|
||||||
Who(chan)
|
Who(chan)
|
||||||
|
|
Loading…
Reference in a new issue