lalala bugs

This commit is contained in:
Ryan Hitchman 2009-07-08 11:48:22 -06:00
parent 9d5a995260
commit a41349bae7
2 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ dbname = "seen.db"
def adapt_datetime(ts): def adapt_datetime(ts):
return time.mktime(ts.timetuple()) return time.mktime(ts.timetuple())
sqlite3.register_adapter(datetime.datetime, adapt_datetime) sqlite3.register_adapter(datetime, adapt_datetime)
@hook.command(hook=r'(.*)', prefix=False, ignorebots=False) @hook.command(hook=r'(.*)', prefix=False, ignorebots=False)
@ -24,7 +24,7 @@ def seeninput(bot, input):
conn = dbconnect(dbpath) conn = dbconnect(dbpath)
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute("insert or replace into seen(name, date, quote, chan)" cursor.execute("insert or replace into seen(name, date, quote, chan)"
"values(?,?,?,?)", (input.nick, datetime.datetime.now(), "values(?,?,?,?)", (input.nick, datetime.now(),
input.msg, input.chan)) input.msg, input.chan))
conn.commit() conn.commit()
conn.close() conn.close()
@ -53,7 +53,7 @@ def seen(bot, input):
conn.close() conn.close()
if(results != None): if(results != None):
reltime = timesince(datetime.datetime.fromtimestamp(results[0])) reltime = timesince.timesince(datetime.fromtimestamp(results[0]))
return '%s was last seen %s ago saying: <%s> %s' % \ return '%s was last seen %s ago saying: <%s> %s' % \
(query, reltime, results[1]) (query, reltime, results[1])
else: else:

View File

@ -2,7 +2,7 @@
import os import os
import time import time
import datetime from datetime import datetime
import sqlite3 import sqlite3
from util import hook, timesince from util import hook, timesince
@ -14,7 +14,7 @@ dbname = "skydb"
def adapt_datetime(ts): def adapt_datetime(ts):
return time.mktime(ts.timetuple()) return time.mktime(ts.timetuple())
sqlite3.register_adapter(datetime.datetime, adapt_datetime) sqlite3.register_adapter(datetime, adapt_datetime)
@hook.command(hook=r'(.*)', prefix=False, ignorebots=True) @hook.command(hook=r'(.*)', prefix=False, ignorebots=True)
@ -33,7 +33,7 @@ def tellinput(bot, input):
tells = cursor.execute(command, (input.nick, input.chan)).fetchall() tells = cursor.execute(command, (input.nick, input.chan)).fetchall()
for tell in tells: for tell in tells:
reltime = timesince(datetime.datetime.fromtimestamp(tell[3])) reltime = timesince.timesince(datetime.fromtimestamp(tell[3]))
bot.reply('%(teller)s said %(reltime)s ago: %(quote)s' % bot.reply('%(teller)s said %(reltime)s ago: %(quote)s' %
{'teller': tell[1], 'quote': tell[2], 'reltime': reltime}) {'teller': tell[1], 'quote': tell[2], 'reltime': reltime})
command = "delete from tell where id = ?" command = "delete from tell where id = ?"
@ -72,11 +72,11 @@ def tell(bot, input):
command = "insert into tell(name, user_from, quote, chan, date) " \ command = "insert into tell(name, user_from, quote, chan, date) " \
"values(?,?,?,?,?)" "values(?,?,?,?,?)"
cursor.execute(command, (query[0], input.nick, query[2], input.chan, cursor.execute(command, (query[0], input.nick, query[2], input.chan,
datetime.datetime.now())) datetime.now()))
conn.commit() conn.commit()
conn.close() conn.close()
return "I'll let (him|her|it) know." return "I'll pass that along."
else: else:
return tell.__doc__ return tell.__doc__