Send captions as second message by default. Fixes #233
This commit is contained in:
+1
-1
@@ -148,7 +148,7 @@ bridge:
|
|||||||
- "@importantbot:example.com"
|
- "@importantbot:example.com"
|
||||||
# Whether to bridge Telegram bot messages as m.notices or m.texts.
|
# Whether to bridge Telegram bot messages as m.notices or m.texts.
|
||||||
bot_messages_as_notices: true
|
bot_messages_as_notices: true
|
||||||
# Use inline images instead of m.image to make rich captions possible.
|
# Use inline images instead of a separate message for the caption.
|
||||||
# N.B. Inline images are not supported on all clients (e.g. Riot iOS).
|
# N.B. Inline images are not supported on all clients (e.g. Riot iOS).
|
||||||
inline_images: false
|
inline_images: false
|
||||||
# Whether to send stickers as the new native m.sticker type or normal m.images.
|
# Whether to send stickers as the new native m.sticker type or normal m.images.
|
||||||
|
|||||||
@@ -1243,11 +1243,19 @@ class Portal:
|
|||||||
"orientation": 0,
|
"orientation": 0,
|
||||||
"mimetype": file.mime_type,
|
"mimetype": file.mime_type,
|
||||||
}
|
}
|
||||||
name = evt.message
|
ext_override = {
|
||||||
|
"image/jpeg": ".jpg"
|
||||||
|
}
|
||||||
|
name = "image" + ext_override.get(file.mime_type, mimetypes.guess_extension(file.mime_type))
|
||||||
await intent.set_typing(self.mxid, is_typing=False)
|
await intent.set_typing(self.mxid, is_typing=False)
|
||||||
return await intent.send_image(self.mxid, file.mxc, info=info, text=name,
|
result = await intent.send_image(self.mxid, file.mxc, info=info, text=name,
|
||||||
relates_to=relates_to, timestamp=evt.date,
|
relates_to=relates_to, timestamp=evt.date,
|
||||||
external_url=self.get_external_url(evt))
|
external_url=self.get_external_url(evt))
|
||||||
|
if evt.message:
|
||||||
|
text, html, _ = await formatter.telegram_to_matrix(evt, source, self.main_intent)
|
||||||
|
await intent.send_text(self.mxid, text, html=html, timestamp=evt.date,
|
||||||
|
external_url=self.get_external_url(evt))
|
||||||
|
return result
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse_telegram_document_attributes(attributes: List[TypeDocumentAttribute]) -> Dict:
|
def _parse_telegram_document_attributes(attributes: List[TypeDocumentAttribute]) -> Dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user