add BufferLine.timestamp (datetime.datetime object)

This commit is contained in:
jesopo 2020-01-17 15:58:08 +00:00
parent e4d71f6c0c
commit 3e574f3c52
2 changed files with 8 additions and 4 deletions

View file

@ -1,4 +1,4 @@
import collections, dataclasses, re, typing
import collections, dataclasses, datetime, re, typing
from src import IRCBot, IRCServer, utils
MAX_LINES = 64
@ -6,15 +6,18 @@ MAX_LINES = 64
@dataclasses.dataclass
class BufferLine(object):
id: str
timestamp: datetime.datetime
sender: str
message: str
action: bool
tags: dict
from_self: bool
method: str
deleted: bool=False
notes: typing.Dict[str, str] = dataclasses.field(
default_factory=dict)
deleted: bool=False
class BufferLineMatch(object):
def __init__(self, line: BufferLine, match: str):

View file

@ -101,8 +101,9 @@ def message(events, event):
buffer_line = None
if message:
buffer_line = IRCBuffer.BufferLine(message_id, user.nickname, message,
action, event["line"].tags, from_self, event["line"].command)
buffer_line = IRCBuffer.BufferLine(message_id, utils.datetime.utcnow(),
user.nickname, message, action, event["line"].tags, from_self,
event["line"].command)
buffer_obj = target_obj
if is_channel: