bypass deleted messages (or rather messages without content)
This commit is contained in:
parent
10209348b3
commit
eef6224007
1 changed files with 20 additions and 19 deletions
|
@ -129,28 +129,29 @@ class ChannelMonitor(threading.Thread):
|
|||
if msg.source.id == app.config['PNUTCLIENT_ID']:
|
||||
continue
|
||||
|
||||
user = self.generate_matrix_id(msg.user.username)
|
||||
text = msg.content.text + "\n"
|
||||
# dt = datetime.datetime.strptime(msg.created_at, "%Y-%m-%dT%H:%M:%SZ")
|
||||
dt = msg.created_at
|
||||
ts = time.mktime(dt.timetuple())
|
||||
if 'content' in msg:
|
||||
user = self.generate_matrix_id(msg.user.username)
|
||||
text = msg.content.text + "\n"
|
||||
# dt = datetime.datetime.strptime(msg.created_at, "%Y-%m-%dT%H:%M:%SZ")
|
||||
dt = msg.created_at
|
||||
ts = time.mktime(dt.timetuple())
|
||||
|
||||
for lnk in msg.content.entities.links:
|
||||
text += "\n"
|
||||
if 'title' in lnk:
|
||||
text += lnk.title + "\n"
|
||||
if 'link' in lnk:
|
||||
text += lnk.link + "\n"
|
||||
for lnk in msg.content.entities.links:
|
||||
text += "\n"
|
||||
if 'title' in lnk:
|
||||
text += lnk.title + "\n"
|
||||
if 'link' in lnk:
|
||||
text += lnk.link + "\n"
|
||||
|
||||
for raw in msg.raw:
|
||||
if raw.type == 'io.pnut.core.oembed':
|
||||
if 'title' in raw.value:
|
||||
text += raw.value.title + "\n"
|
||||
if 'url' in raw.value:
|
||||
text += raw.value.url + "\n"
|
||||
for raw in msg.raw:
|
||||
if raw.type == 'io.pnut.core.oembed':
|
||||
if 'title' in raw.value:
|
||||
text += raw.value.title + "\n"
|
||||
if 'url' in raw.value:
|
||||
text += raw.value.url + "\n"
|
||||
|
||||
# queue the message in reverse order (because of how pnut returns the messages)
|
||||
pqueue.insert(0, {'user':user,'text':text,'ts':ts,'msgid':msg.id,'puser':msg.user.username,'chan':room.pnut_chan})
|
||||
# queue the message in reverse order (because of how pnut returns the messages)
|
||||
pqueue.insert(0, {'user':user,'text':text,'ts':ts,'msgid':msg.id,'puser':msg.user.username,'chan':room.pnut_chan})
|
||||
|
||||
# update the last message id
|
||||
if len(messages) > 0:
|
||||
|
|
Loading…
Reference in a new issue