Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
facebook
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
mautrix
facebook
Commits
7e1e4398
Commit
7e1e4398
authored
5 years ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mautrix_facebook/portal.py
+3
-2
3 additions, 2 deletions
mautrix_facebook/portal.py
with
3 additions
and
2 deletions
mautrix_facebook/portal.py
+
3
−
2
View file @
7e1e4398
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment