diff options
| author | 2019-02-10 14:18:33 +0000 | |
|---|---|---|
| committer | 2019-02-10 14:18:33 +0000 | |
| commit | 47725641150b0d0fb99366d7c6ef6edbb2ffb3e5 (patch) | |
| tree | fa6dc27ac5373a935944a30e7df84387ba0f11c1 /src/IRCLine.py | |
| parent | `now` isn't defined now that throttle code has been separated out (src/IRCSer... (diff) | |
| signature | ||
Add missing src/IRCLine.py file
Diffstat (limited to 'src/IRCLine.py')
| -rw-r--r-- | src/IRCLine.py | 20 |
1 files changed, 20 insertions, 0 deletions
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() |
