[cleanwash]: Inform the user if they don't have TCN in Ju.

Inform the user that they don't have TCN in Ju.
I know this should be rewritten using arpgarse probably to make my life
easier, but I don't know how I'd represent the help, maybe making `-h`
send help (in many messages) to privmsg.
Suggestions welcome.
master
jmjl 2023-10-04 17:46:35 +00:00
parent 8eb7f14594
commit d15e047bc1
1 changed files with 1 additions and 0 deletions

View File

@ -26,6 +26,7 @@ def cleanwash_money(msg):
nick = msg.nick nick = msg.nick
if msg.nick in msg.ops and msg.arg: nick = msg.arg if msg.nick in msg.ops and msg.arg: nick = msg.arg
balance = Decimal(subprocess.check_output(['/home/jmjl/bin/coin','Ju','internal_balance',nick],universal_newlines=True)) balance = Decimal(subprocess.check_output(['/home/jmjl/bin/coin','Ju','internal_balance',nick],universal_newlines=True))
if balance == Decimal(0): return pinhook.plugin.message("You don't have any tildecoins with us, so you can't cleanwash")
subprocess.check_output(['/home/jmjl/bin/coin','Ju','add_internal_balance',nick,f'-{str(balance)}'],universal_newlines=True).strip() subprocess.check_output(['/home/jmjl/bin/coin','Ju','add_internal_balance',nick,f'-{str(balance)}'],universal_newlines=True).strip()
new_balance = Decimal(randint(80,110))/Decimal(100)*Decimal(balance) new_balance = Decimal(randint(80,110))/Decimal(100)*Decimal(balance)
new_balance = new_balance.quantize(Decimal('1.'), rounding=ROUND_DOWN) new_balance = new_balance.quantize(Decimal('1.'), rounding=ROUND_DOWN)