Skip to content
Snippets Groups Projects
Commit 7e1e4398 authored by Tulir Asokan's avatar Tulir Asokan :cat2:
Browse files

Handle message as text message if none of the attachments were recognized

parent 2c96be6b
No related branches found
No related tags found
No related merge requests found
...@@ -424,17 +424,18 @@ class Portal: ...@@ -424,17 +424,18 @@ class Portal:
" puppet is not in room.") " puppet is not in room.")
return return
intent = sender.intent_for(self) intent = sender.intent_for(self)
event_ids = []
if message.sticker: if message.sticker:
event_ids = [await self._handle_facebook_sticker(intent, message.sticker)] event_ids = [await self._handle_facebook_sticker(intent, message.sticker)]
elif len(message.attachments) > 0: elif len(message.attachments) > 0:
event_ids = await asyncio.gather( event_ids = await asyncio.gather(
*[self._handle_facebook_attachment(intent, attachment) *[self._handle_facebook_attachment(intent, attachment)
for attachment in message.attachments]) for attachment in message.attachments])
elif message.text: event_ids = [event_id for event_id in event_ids if event_id]
if not event_ids and message.text:
event_ids = [await self._handle_facebook_text(intent, message)] event_ids = [await self._handle_facebook_text(intent, message)]
else: else:
self.log.warn(f"Unhandled Messenger message: {message}") self.log.warn(f"Unhandled Messenger message: {message}")
event_ids = []
DBMessage.bulk_create(fbid=message.uid, fb_receiver=self.fb_receiver, mx_room=self.mxid, DBMessage.bulk_create(fbid=message.uid, fb_receiver=self.fb_receiver, mx_room=self.mxid,
event_ids=[event_id for event_id in event_ids if event_id]) event_ids=[event_id for event_id in event_ids if event_id])
await source.markAsDelivered(self.fbid, message.uid) await source.markAsDelivered(self.fbid, message.uid)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment