Set body of media replies to what official client sets them to
This commit is contained in:
parent
ae9fd46bc8
commit
d452735691
|
@ -101,8 +101,13 @@ async def matrix_to_kakaotalk(
|
|||
src_converted = await matrix_to_kakaotalk(src_event.content, room_id, log, intent, skip_reply=True)
|
||||
if src_event.content.relates_to.rel_type == RelationType.REPLY:
|
||||
src_type = KnownChatType.REPLY
|
||||
src_message = src_converted.text
|
||||
else:
|
||||
src_type = TO_MSGTYPE_MAP[src_event.content.msgtype]
|
||||
if src_type == KnownChatType.FILE:
|
||||
src_message = _media_type_reply_body_map[KnownChatType.FILE] + src_converted.text
|
||||
else:
|
||||
src_message = _media_type_reply_body_map.get(src_type, src_converted.text)
|
||||
reply_to = ReplyAttachment(
|
||||
# NOTE mentions will be merged into this later
|
||||
# TODO Set this for emoticon reply, but must first support them
|
||||
|
@ -114,13 +119,13 @@ async def matrix_to_kakaotalk(
|
|||
attach_type=0,
|
||||
src_logId=message.ktid,
|
||||
src_mentions=src_converted.mentions or [],
|
||||
src_message=src_converted.text,
|
||||
src_message=src_message,
|
||||
src_type=src_type,
|
||||
src_userId=src_kt_sender,
|
||||
)
|
||||
else:
|
||||
reply_to = None
|
||||
if content.get("format", None) == Format.HTML and content["formatted_body"]:
|
||||
if content.get("format", None) == Format.HTML and content["formatted_body"] and content.msgtype.is_text:
|
||||
parsed = await ToKakaoTalkParser().parse(content["formatted_body"])
|
||||
text = parsed.text
|
||||
mentions_by_user: dict[Long, MentionStruct] = {}
|
||||
|
@ -149,3 +154,11 @@ async def matrix_to_kakaotalk(
|
|||
text = content.body
|
||||
mentions = None
|
||||
return SendParams(text=text, mentions=mentions, reply_to=reply_to)
|
||||
|
||||
|
||||
_media_type_reply_body_map: dict[KnownChatType, str] = {
|
||||
KnownChatType.PHOTO: "Photo",
|
||||
KnownChatType.VIDEO: "Video",
|
||||
KnownChatType.AUDIO: "Voice Note",
|
||||
KnownChatType.FILE: "File: ",
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue