diff options
author | luk3yx <luk3yx@users.noreply.github.com> | 2022-05-12 19:48:37 +1200 |
---|---|---|
committer | luk3yx <luk3yx@users.noreply.github.com> | 2022-05-12 19:48:37 +1200 |
commit | 2af549e79726901586a3ba312a66b39a7a594eb6 (patch) | |
tree | 61512a318e1ea4bfed09174638217e33ace363a8 | |
parent | a334c673b2f16cd457edebff7e0868e21194f71a (diff) | |
download | miniirc_idc-2af549e79726901586a3ba312a66b39a7a594eb6.tar.gz miniirc_idc-2af549e79726901586a3ba312a66b39a7a594eb6.zip |
Add time tag to multiline messages
-rwxr-xr-x | idc_irc_proxy.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/idc_irc_proxy.py b/idc_irc_proxy.py index d946fe1..1faa5f2 100755 --- a/idc_irc_proxy.py +++ b/idc_irc_proxy.py @@ -5,7 +5,7 @@ # © 2022 by luk3yx # -import miniirc, miniirc_idc, os, socket, threading, traceback +import datetime, miniirc, miniirc_idc, os, socket, threading, traceback from concurrent.futures import ThreadPoolExecutor from miniirc_extras.utils import (ircv2_message_unparser, ircv3_message_parser, ircv3_message_unparser) @@ -88,12 +88,19 @@ class Proxy: args = [args[0], args[-1][6:]] elif cmd == 'PRIVMSG' and ('\n' in args[-1] or '\r' in args[-1]): message = args[-1].replace('\r\n', '\n').replace('\r', '\n') + if 'time' not in tags: + tags = { + 'time': datetime.datetime.utcnow().isoformat( + timespec='milliseconds' + ) + 'Z', + **tags + } for i, line in enumerate(message.split('\n', 9)): if i > 0: line = '\u200b' + line self.send(cmd, hostmask, tags, [args[0], line]) if i == 0: - tags = {} + tags = {'time': tags['time']} return # Send the command to the client |