add IRCBuffer.BufferLine.format() - /me vs message formatting

This commit is contained in:
jesopo 2020-01-30 14:56:57 +00:00
parent 5fb3057814
commit b296a2df05
2 changed files with 8 additions and 4 deletions

View file

@ -134,10 +134,7 @@ class Module(ModuleManager.BaseModule):
lines_str = []
for line in lines:
if line.action:
lines_str.append("* %s %s" % (line.sender, line.message))
else:
lines_str.append("<%s> %s" % (line.sender, line.message))
lines_str.append(line.format())
text = " ".join(lines_str)
quotes.append([event["user"].name, int(time.time()), text])

View file

@ -22,6 +22,13 @@ class BufferLine(object):
timestamp: datetime.datetime = dataclasses.field(
default_factory=utils.datetime.utcnow)
def format(self):
if self.action:
format = "* %s %s"
else:
format = "<%s> %s"
return format % (self.sender, self.message)
class BufferLineMatch(object):
def __init__(self, line: BufferLine, match: str):
self.line = line