Compare commits

..

No commits in common. "e7bb648f96169ee1875909aec2c9c6ff3ba36289" and "25741faa931a5c4a7d3c2472199c7fb51d7133cd" have entirely different histories.

13 changed files with 29 additions and 18 deletions

17
.gitignore vendored
View File

@ -1,7 +1,14 @@
*.log venv/
__pycache__/
config.json
data/
json/ json/
users/ users/
venv/ __pycache__/
doctorow_ebooks.txt
.indexme
*.swp
*.log
config.ini
config.json
plugins/pronouns.json
plugins/ebooks/
optout
secrets.toml

24
bot.py
View File

@ -8,22 +8,28 @@ with open('config.json') as c:
config = json.load(c) config = json.load(c)
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) > 1 and if sys.argv[1] == '--test-mode': if len(sys.argv) > 1:
channels = config['test']['channels'] if sys.argv[1] == '--test-mode':
cmd_prefix = config['test']['cmd_prefix'] channels = ['#jmjl-devel']
nick = f"{config['nickname']}{config['test']['nick_suffix']}" nick = 'ju[dev]'
prefix_plugins = True prefix_plugins = True
cmd_prefix='^'
else:
channels = config['channels']
prefix_plugins = False
cmd_prefix='&'
nick = 'ju'
else: else:
channels = config['channels'] channels = config['channels']
cmd_prefix = config['cmd_prefix'] nick = 'ju'
nick = config['nickname']
prefix_plugins = False prefix_plugins = False
cmd_prefix='&'
bot = pinhook.bot.Bot( bot = pinhook.bot.Bot(
channels, channels,
nick, nick,
'localhost', 'localhost',
ops=config['ops'], ops=['jmjl'],
ns_pass=f"{config['nickname'] {config['password']}", ns_pass='ju {}'.format(config['password']),
#ns_pass=config['password'], #ns_pass=config['password'],
nickserv='nickserv', nickserv='nickserv',
cmd_prefix=cmd_prefix, cmd_prefix=cmd_prefix,

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugins/.rps.py.un~ 100644

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -111,8 +111,6 @@ def cleanwash_money(msg):
#new_balance=((__import__('random').randint(80,110)/100)*balance).split('.')[0] #new_balance=((__import__('random').randint(80,110)/100)*balance).split('.')[0]
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)
percentage_return = new_balance/balance * Decimal(100)
percentage_return = percentage_return.quantize(Decimal('.00'), rounding=ROUND_DOWN)
#jackpot_balance=(0.10*balance).split('.')[0] #jackpot_balance=(0.10*balance).split('.')[0]
jackpot_balance = (Decimal(0.10)*Decimal(balance)).quantize(Decimal('1.'), rounding=ROUND_DOWN) jackpot_balance = (Decimal(0.10)*Decimal(balance)).quantize(Decimal('1.'), rounding=ROUND_DOWN)
with open(util.tilde.JACKPOT_FILE, "r+") as jackpotfile: with open(util.tilde.JACKPOT_FILE, "r+") as jackpotfile:
@ -121,6 +119,6 @@ def cleanwash_money(msg):
jackpotfile.truncate() jackpotfile.truncate()
jackpot_now = str(jackpot + jackpot_balance) jackpot_now = str(jackpot + jackpot_balance)
jackpotfile.write(jackpot_now) jackpotfile.write(jackpot_now)
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 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)

2
run.sh
View File

@ -2,4 +2,4 @@
cd ~jmjl/dev/juju cd ~jmjl/dev/juju
exec /home/jmjl/usr/share/python/venv/pinhook-juju/bin/python /home/jmjl/dev/juju/bot.py "$1" exec /home/jmjl/usr/share/python/venv/pinhook-juju/bin/python /home/jmjl/dev/juju/bot.py