Add missing src/IRCLine.py file
This commit is contained in:
parent
28107292f5
commit
4772564115
1 changed files with 20 additions and 0 deletions
20
src/IRCLine.py
Normal file
20
src/IRCLine.py
Normal file
|
@ -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()
|
Loading…
Reference in a new issue