add IRCBuffer.BufferLine.format() - /me vs message formatting
This commit is contained in:
parent
5fb3057814
commit
b296a2df05
2 changed files with 8 additions and 4 deletions
|
@ -134,10 +134,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
lines_str = []
|
lines_str = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.action:
|
lines_str.append(line.format())
|
||||||
lines_str.append("* %s %s" % (line.sender, line.message))
|
|
||||||
else:
|
|
||||||
lines_str.append("<%s> %s" % (line.sender, line.message))
|
|
||||||
text = " ".join(lines_str)
|
text = " ".join(lines_str)
|
||||||
|
|
||||||
quotes.append([event["user"].name, int(time.time()), text])
|
quotes.append([event["user"].name, int(time.time()), text])
|
||||||
|
|
|
@ -22,6 +22,13 @@ class BufferLine(object):
|
||||||
timestamp: datetime.datetime = dataclasses.field(
|
timestamp: datetime.datetime = dataclasses.field(
|
||||||
default_factory=utils.datetime.utcnow)
|
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):
|
class BufferLineMatch(object):
|
||||||
def __init__(self, line: BufferLine, match: str):
|
def __init__(self, line: BufferLine, match: str):
|
||||||
self.line = line
|
self.line = line
|
||||||
|
|
Loading…
Reference in a new issue