Changed seen to use utils.timeElapsed.

This commit is contained in:
Jeremy Fincher 2003-04-12 10:39:04 +00:00
parent f6a286b311
commit 066ed44b04

View File

@ -36,6 +36,7 @@ statistics about smileys, actions, characters, and words.
Commands include: Commands include:
seen seen
stats
""" """
from baseplugin import * from baseplugin import *
@ -46,6 +47,7 @@ import time
import sqlite import sqlite
import debug import debug
import utils
import ircdb import ircdb
import ircmsgs import ircmsgs
import privmsgs import privmsgs
@ -241,20 +243,9 @@ class ChannelStats(callbacks.Privmsg, ChannelDBHandler):
else: else:
(seen, m) = cursor.fetchone() (seen, m) = cursor.fetchone()
seen = int(seen) seen = int(seen)
ago = int(time.time()) - seen s = '%s was last seen here %s ago saying %r' % \
days = ago / 86400 (name, utils.timeElapsed(time.time(), seen), m)
ago %= 86400 irc.reply(msg, s)
hours = ago / 3600
ago %= 3600
minutes = ago / 60
seconds = ago % 60
s = '%s day%s %s hour%s %s minute%s %s second%sago' % \
(days, days == 1 and ',' or 's,',
hours, hours == 1 and ',' or 's,',
minutes, minutes == 1 and ',' or 's,',
seconds, seconds == 1 and ' ' or 's ')
irc.reply(msg, '%s was last seen here at %s saying %r' % \
(name, s, m))
def stats(self, irc, msg, args): def stats(self, irc, msg, args):
"[<channel>] (if not sent in the channel itself) <nick>" "[<channel>] (if not sent in the channel itself) <nick>"