Send captions as second message by default. Fixes #233

This commit is contained in:
Tulir Asokan
2018-09-29 10:56:04 +03:00
parent 2f6147f325
commit 980e0d6ef7
2 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -148,7 +148,7 @@ bridge:
- "@importantbot:example.com"
# Whether to bridge Telegram bot messages as m.notices or m.texts.
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).
inline_images: false
# Whether to send stickers as the new native m.sticker type or normal m.images.
+12 -4
View File
@@ -1243,11 +1243,19 @@ class Portal:
"orientation": 0,
"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)
return await intent.send_image(self.mxid, file.mxc, info=info, text=name,
relates_to=relates_to, timestamp=evt.date,
external_url=self.get_external_url(evt))
result = await intent.send_image(self.mxid, file.mxc, info=info, text=name,
relates_to=relates_to, timestamp=evt.date,
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
def _parse_telegram_document_attributes(attributes: List[TypeDocumentAttribute]) -> Dict: