Pick from v4 message tag parser
This commit is contained in:
parent
ee14682c4f
commit
cccee20cdf
11
message.py
11
message.py
@ -118,6 +118,17 @@ class Message:
|
|||||||
self.cmds = self.text.split(' ')
|
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):
|
def decode(self, s):
|
||||||
"""Decode the content string usign a specific encoding"""
|
"""Decode the content string usign a specific encoding"""
|
||||||
if isinstance(s, bytes):
|
if isinstance(s, bytes):
|
||||||
|
Loading…
Reference in New Issue
Block a user