[Tell] Why won't this work :-/

master
Sfan5 2014-02-05 20:14:43 +01:00
parent 8ec91babee
commit a4e13a816c
1 changed files with 9 additions and 1 deletions

10
tell.py
View File

@ -51,7 +51,7 @@ def checktell(phenny, input):
global tell_diskwriteinterval, tell_lastdiskwrite, tell_lastlisthash, tell_pending global tell_diskwriteinterval, tell_lastdiskwrite, tell_lastlisthash, tell_pending
for e in tell_list: for e in tell_list:
if e[1].lower() == input.nick.lower(): if e[1].lower() == input.nick.lower():
phenny.say("%s: %s <%s> %s" % (input.nick, time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(e[3])), e[0], e[2])) phenny.say("%s: %s <%s> %s" % (input.nick, time.strftime('%m-%d %H:%M UTC', time.gmtime(e[3])), e[0], e[2]))
tell_list.remove(e) tell_list.remove(e)
tell_pending.append(("DELETE FROM tell WHERE nick = ? AND tellee = ? AND msg = ? AND time = ?", e)) tell_pending.append(("DELETE FROM tell WHERE nick = ? AND tellee = ? AND msg = ? AND time = ?", e))
break break
@ -86,6 +86,14 @@ note_join.rule = r'.*'
note_join.event = 'JOIN' note_join.event = 'JOIN'
note_join.priority = 'low' note_join.priority = 'low'
def telldebug(phenny, input):
current_hash = hashlib.sha1('\n'.join(repr(e) for e in tell_list)).hexdigest()
lastwrite = time.strftime('%Y-%m-%d %H:%M:%S UTC', time.gmtime(tell_lastdiskwrite))
nextwrite = time.strftime('%Y-%m-%d %H:%M:%S UTC', time.gmtime(tell_lastdiskwrite + tell_diskwriteinterval))
phenny.say("Current hash '" + current_hash + "' last hash '" + tell_lastlisthash + "' last write " + lastwrite + " next write " + nextwrite)
telldebug.commands = ['telldbg']
db = sqlite3.connect("tell.sqlite") db = sqlite3.connect("tell.sqlite")
c = db.cursor() c = db.cursor()
c.execute("CREATE TABLE IF NOT EXISTS tell (id INTEGER PRIMARY KEY, nick TEXT, tellee TEXT, msg TEXT, time INTEGER)") c.execute("CREATE TABLE IF NOT EXISTS tell (id INTEGER PRIMARY KEY, nick TEXT, tellee TEXT, msg TEXT, time INTEGER)")