Compare commits
3 Commits
5caff13c38
...
4f631e96fe
Author | SHA1 | Date |
---|---|---|
jmjl | 4f631e96fe | |
jmjl | 1d3622d0cb | |
jmjl | 44377a58e9 |
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import pinhook.plugin
|
||||
import util.tilde
|
||||
import inspect
|
||||
|
||||
def err(msg): return pinhook.plugin.message(msg)
|
||||
|
||||
@pinhook.plugin.command('<e', 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)
|
|
@ -43,10 +43,6 @@ 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))
|
||||
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue