From 47725641150b0d0fb99366d7c6ef6edbb2ffb3e5 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 10 Feb 2019 14:18:33 +0000 Subject: [PATCH] Add missing src/IRCLine.py file --- src/IRCLine.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/IRCLine.py diff --git a/src/IRCLine.py b/src/IRCLine.py new file mode 100644 index 00000000..eeb90f1a --- /dev/null +++ b/src/IRCLine.py @@ -0,0 +1,20 @@ +import datetime, typing +from src import IRCObject + +class Line(IRCObject.Object): + def __init__(self, send_time: datetime.datetime, data: str): + self.send_time = send_time + self.data = data + + self._on_send = [] # type: typing.List[typing.Callable[[], None]] + + def __repr__(self) -> str: + return "IRCLine.Line(%s)" % self.__str__() + def __str__(self) -> str: + return self.data + + def on_send(self, func: typing.Callable[[], None]): + self._on_send.append(func) + def sent(self): + for func in self._on_send[:]: + func()