Compare commits
No commits in common. "8eb7f145940cda5fb79c1b54b40464f85a4e3d95" and "fe6ace02e730db3d0f101d0fa3d175ff67334a22" have entirely different histories.
8eb7f14594
...
fe6ace02e7
|
@ -3,7 +3,6 @@
|
||||||
import pinhook.plugin
|
import pinhook.plugin
|
||||||
import util.tilde
|
import util.tilde
|
||||||
import subprocess
|
import subprocess
|
||||||
import uuid
|
|
||||||
from random import randint
|
from random import randint
|
||||||
from decimal import Decimal,ROUND_DOWN,ROUND_UP
|
from decimal import Decimal,ROUND_DOWN,ROUND_UP
|
||||||
|
|
||||||
|
@ -41,33 +40,3 @@ def cleanwash_money(msg):
|
||||||
message = f"Cleanwashed {balance}TCN, and given the user {new_balance}TCN ({percentage_return}%) and contributed {jackpot_balance}TCN to the balance, jackpot at {jackpot_now}TCN"
|
message = f"Cleanwashed {balance}TCN, and given the user {new_balance}TCN ({percentage_return}%) and contributed {jackpot_balance}TCN to the balance, jackpot at {jackpot_now}TCN"
|
||||||
util.tilde.admin_update_tilde(nick,amount=new_balance,time=msg.timestamp,comment=message)
|
util.tilde.admin_update_tilde(nick,amount=new_balance,time=msg.timestamp,comment=message)
|
||||||
return pinhook.plugin.message(message)
|
return pinhook.plugin.message(message)
|
||||||
|
|
||||||
@pinhook.plugin.command('&brainwashreturnbeforeplaying', help_text='Alias -- &cleanwashreturnbeforeplaying')
|
|
||||||
@pinhook.plugin.command('&cleanwashreturnbeforeplaying', help_text='Give you back your money, if it wasn\'t dirty money.')
|
|
||||||
def cleanwash_return_before(msg):
|
|
||||||
if util.tilde.ADMIN_ONLY and msg.nick not in msg.ops:
|
|
||||||
return
|
|
||||||
if msg.channel != util.tilde.GOOD_CHAN and not util.tilde.DEBUG:
|
|
||||||
return pinhook.plugin.message("{} is a meanie and gets no washed money. **ju only works in the {} channel.**".format(msg.nick, util.tilde.GOOD_CHAN))
|
|
||||||
nick = msg.nick
|
|
||||||
if msg.nick in msg.ops and msg.arg: nick = msg.arg.split(' ')[1]
|
|
||||||
amount_to_return = None
|
|
||||||
try:
|
|
||||||
if msg.arg:
|
|
||||||
amount_to_return_str = msg.arg.split(' ')[0]
|
|
||||||
amount_to_return = Decimal(amount_to_return_str)
|
|
||||||
except Exception: return pinhook.plugin.message(f"{msg.nick}: Error, {msg.arg.split(' ')[0]} is probably not a number")
|
|
||||||
balance = Decimal(subprocess.check_output(['/home/jmjl/bin/coin','Ju','internal_balance',nick],universal_newlines=True))
|
|
||||||
if not amount_to_return: amount_to_return = balance
|
|
||||||
if amount_to_return > balance: return pinhook.plugin.message(f"{msg.nick}: Error, {amount_to_return} is more than what you have with us. (You have {balance}TCN returnable with us)")
|
|
||||||
sentproc = subprocess.run(['/home/jmjl/bin/coin','Ju','send',nick,str(amount_to_return.quantize(Decimal('.00'),rounding=ROUND_DOWN))],capture_output=True,text=True)
|
|
||||||
if sentproc.returncode == 0: return pinhook.plugin.message(f"{msg.nick}: Succesfully sent {amount_to_return}TCN back")
|
|
||||||
else:
|
|
||||||
err_id = str(uuid.uuid4())
|
|
||||||
return pinhook.plugin.message(f"{msg.nick}: Failed for some reason, consult bot admin. [{err_id}")
|
|
||||||
print(f"[ERROR]: ju/tildewash: Failed to return {amount_to_return}TCN from {nick} [{err_id}")
|
|
||||||
print(f"Stdout [{err_id}]")
|
|
||||||
print(sentproc.stdout)
|
|
||||||
print(f"Stderr [{err_id}]")
|
|
||||||
print(sentproc.stderr)
|
|
||||||
print(f"End [{err_id}]")
|
|
||||||
|
|
|
@ -15,12 +15,12 @@ verbs = [
|
||||||
|
|
||||||
class IgnoredUsers:
|
class IgnoredUsers:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if 'data/nowater.txt' not in listdir():
|
if 'date/nowater.txt' not in listdir():
|
||||||
open('data/nowater.txt', 'w').close()
|
open('date/nowater.txt', 'w').close()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def users(self):
|
def users(self):
|
||||||
with open('data/nowater.txt', 'r') as w:
|
with open('date/nowater.txt', 'r') as w:
|
||||||
u = [i.strip() for i in w.readlines() if i.strip()]
|
u = [i.strip() for i in w.readlines() if i.strip()]
|
||||||
return u
|
return u
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue