From def59646588e107c064655e7c4c69de00bdd00a0 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Wed, 5 May 2021 08:08:47 -0500 Subject: [PATCH] track, display timestamp of history --- history/ircplugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/history/ircplugin.py b/history/ircplugin.py index 4a8b6cb..54b20af 100644 --- a/history/ircplugin.py +++ b/history/ircplugin.py @@ -1,5 +1,6 @@ """Monitor and playback IRC stuff.""" import logging +from datetime import datetime import irc.client @@ -47,10 +48,11 @@ class History(Plugin): what = event.arguments[0] where = event.target who = irc.client.NickMask(event.source).nick + when = datetime.now() logger.debug("tracking message for %s: (%s,%s)", where, who, what) history = self.channel_history.setdefault(where, []) - history.append((who, what)) + history.append((when.isoformat(), who, what)) logger.debug("history for %s: %s", where, history) # for when we maybe don't see a join, if they talked in the channel, add them to it @@ -107,7 +109,7 @@ class History(Plugin): def _send_history(self, who, history): """Reply to who with missed history.""" for line in history: - self.bot.privmsg(who, f"<{line[0]}> {line[1]}") + self.bot.privmsg(who, f"[{line[0]}] <{line[1]}> {line[2]}") def _add_channel_leave_point(self, where, who): """Note that the given who left the channel at the current history point."""