Fixed .showtells command. It should now correctly private message all available messages.

This commit is contained in:
Hamled 2010-01-30 11:09:34 -08:00
parent d2ad68cc4e
commit 7245621341
1 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ def adapt_datetime(ts):
sqlite3.register_adapter(datetime, adapt_datetime) sqlite3.register_adapter(datetime, adapt_datetime)
@hook.command(hook=r'(.*)', prefix=False, ignorebots=True) @hook.command(hook=r'^(?!\.showtells)(.*)', prefix=False, ignorebots=True)
def tellinput(bot, input): def tellinput(bot, input):
dbpath = os.path.join(bot.persist_dir, dbname) dbpath = os.path.join(bot.persist_dir, dbname)
conn = dbconnect(dbpath) conn = dbconnect(dbpath)
@ -37,7 +37,7 @@ def tellinput(bot, input):
reply = "%(teller)s said %(reltime)s ago: %(quote)s" % \ 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}
if more: if more:
reply += " (+%(more)d more, to view say .showtells)" % {"more": more} reply += " (+%(more)d more, to view use .showtells)" % {"more": more}
input.reply(reply) input.reply(reply)
command = "delete from tell where id = ?" command = "delete from tell where id = ?"
@ -61,7 +61,7 @@ def showtells(bot, input):
if(len(tells) > 0): if(len(tells) > 0):
for tell in tells: for tell in tells:
reltime = timesince.timesince(datetime.fromtimestamp(tell[3])) reltime = timesince.timesince(datetime.fromtimestamp(tell[3]))
input.msg(input.nick, '%(teller)s said %(time)s ago: %(quote)s' % input.pm('%(teller)s said %(time)s ago: %(quote)s' % \
{'teller': tell[1], 'quote': tell[2], 'time': reltime}) {'teller': tell[1], 'quote': tell[2], 'time': reltime})
command = "delete from tell where id = ?" command = "delete from tell where id = ?"