Compare commits

..

No commits in common. "4f631e96fe9e9571f74a26b9afb1d617091f2d98" and "5caff13c383e1fac0fe60efa547811a8b5288fd7" have entirely different histories.

3 changed files with 7 additions and 32 deletions

View File

@ -1,29 +0,0 @@
#!/usr/bin/python3
import pinhook.plugin
import util.tilde
import inspect
def err(msg): return pinhook.plugin.message(msg)
@pinhook.plugin.command('&lte', help_text='Alias -- &last_tilde_answer')
@pinhook.plugin.command('&last_tilde_answer', help_text='See the last_tilde\'s answer', ops=False, ops_msg='This command is admin-only as it\'s flaky, and a bit broken.')
def last_tilde(msg):
nick = msg.nick
pnick = msg.nick
if nick not in msg.ops:
retmsg = None
if not msg.arg: return err("This command is a bit flaky, if you accept that run this command again with a parameter called flaky, so run `&last_tilde flaky`")
if msg.arg and msg.arg != 'flaky': return err("This command maybe won't return what you expect, if you want to run it anyways pass a argument called `flaky`")
elif msg.arg: nick = msg.arg.split(' ')[0]
answer = None
try: data = util.tilde.old_challenges[nick][0]
except KeyError: return err("User hasn't played &tilde from the last boot.")
if callable(data):
data = inspect.getclosurevars(data).nonlocals
if len(data) == 0:
data = inspect.getsource(data)
if answer is None:
data = str(data)
answer = f"{pnick}'s last tilde's answer was supposed to be `{data}`."
return pinhook.plugin.message(answer)

4
plugins/tilde.py 100644 → 100755
View File

@ -43,6 +43,10 @@ def timeskip_plugin(msg):
return
if msg.arg:
util.tilde.TIMESKIP = (msg.arg.lower() == 'true' or msg.arg.lower() == 't')
with open(util.tilde.TIMESKIP_FILE, "r+") as timeskipfile:
timeskipfile.seek(0)
timeskipfile.truncate()
timeskipfile.write(str(util.tilde.TIMESKIP))
return pinhook.plugin.message("TIMESKIP set to '{}'".format(util.tilde.TIMESKIP))

View File

@ -1,7 +1,7 @@
#!/usr/bin/python3
import pinhook.plugin
#import util.tilde
import util.tilde
import importlib
import subprocess
@ -11,8 +11,8 @@ def tilde_wait(msg):
found = False
if msg.arg: nicktouse = ''.join(msg.arg.split(' '))
else: nicktouse = msg.nick
# if util.tilde.TIMESKIP:
# return pinhook.plugin.message(f"{msg.nick}: You don't have to wait, timeskip is on")
if util.tilde.TIMESKIP:
return pinhook.plugin.message(f"{msg.nick}: You don't have to wait, timeskip is on")
with open("/home/jmjl/dev/juju/data/tildescores.txt", "r") as scorefile:
scores = scorefile.readlines()
for score in scores: