diff --git a/modules/quotes.py b/modules/quotes.py index f6dd223f..a843bdfb 100644 --- a/modules/quotes.py +++ b/modules/quotes.py @@ -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]) diff --git a/src/IRCBuffer.py b/src/IRCBuffer.py index d1e0a2d2..013cfb98 100644 --- a/src/IRCBuffer.py +++ b/src/IRCBuffer.py @@ -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