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()