From cccee20cdf68fe9c291aff1563ac442ce40fb5ab Mon Sep 17 00:00:00 2001 From: nemunaire Date: Mon, 8 Sep 2014 02:26:07 +0200 Subject: [PATCH] Pick from v4 message tag parser --- message.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/message.py b/message.py index 20a120b..f469319 100644 --- a/message.py +++ b/message.py @@ -118,6 +118,17 @@ class Message: self.cmds = self.text.split(' ') + def add_tag(self, key, value=None): + """Add an IRCv3.2 Message Tags""" + # Treat special tags + if key == "time": + # TODO: this is UTC timezone, nemubot works with local timezone + value = datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%fZ") + + # Store tag + self.tags[key] = value + + def decode(self, s): """Decode the content string usign a specific encoding""" if isinstance(s, bytes):