Preserve the last seen timestamp
So that we can mark posts from bots as read. Otherwise we could end up sending empty messages until another human posts. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
49d5be8a76
commit
a88669d5e4
|
@ -57,6 +57,9 @@ class Message:
|
||||||
links = []
|
links = []
|
||||||
count = 0
|
count = 0
|
||||||
for line in self.__text:
|
for line in self.__text:
|
||||||
|
if len(line) == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
line, link = _text_parse_tags(line)
|
line, link = _text_parse_tags(line)
|
||||||
while line.count("[#####]") > 0:
|
while line.count("[#####]") > 0:
|
||||||
line = line.replace("[#####]", "[%s]" % count, 1)
|
line = line.replace("[#####]", "[%s]" % count, 1)
|
||||||
|
@ -65,6 +68,8 @@ class Message:
|
||||||
lines += [ "" ] + textwrap.wrap(line)
|
lines += [ "" ] + textwrap.wrap(line)
|
||||||
links += link
|
links += link
|
||||||
|
|
||||||
|
if len(lines) == 0:
|
||||||
|
return ""
|
||||||
text = "\n ".join(lines)
|
text = "\n ".join(lines)
|
||||||
if len(links) > 0:
|
if len(links) > 0:
|
||||||
text += "\n __________"
|
text += "\n __________"
|
||||||
|
|
|
@ -51,11 +51,11 @@ class Thread:
|
||||||
self.fetch_info()
|
self.fetch_info()
|
||||||
|
|
||||||
# Read original message list
|
# Read original message list
|
||||||
o_list = []
|
messages = self.do_fetch_messages(self.__last_ts)
|
||||||
for message in self.do_fetch_messages(self.__last_ts):
|
o_list = [ chat.Message(msg) for msg in messages ]
|
||||||
if message["text"] != None and len(message["text"]) > 0:
|
|
||||||
o_list += [ chat.Message(message) ]
|
|
||||||
o_list.sort()
|
o_list.sort()
|
||||||
|
if len(o_list) == 0:
|
||||||
|
return o_list
|
||||||
|
|
||||||
# Merge together messages from the same user
|
# Merge together messages from the same user
|
||||||
m_list = [ o_list[0] ]
|
m_list = [ o_list[0] ]
|
||||||
|
|
Loading…
Reference in New Issue