From 37101f42c1b69a8b7e8f071b0882b6bcfea5e862 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 9 May 2022 03:24:11 -0400 Subject: [PATCH] Friend cmds: Use same mention formatting as outbound message formatter --- matrix_appservice_kakaotalk/commands/kakaotalk.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/matrix_appservice_kakaotalk/commands/kakaotalk.py b/matrix_appservice_kakaotalk/commands/kakaotalk.py index 46d6979..31b498e 100644 --- a/matrix_appservice_kakaotalk/commands/kakaotalk.py +++ b/matrix_appservice_kakaotalk/commands/kakaotalk.py @@ -19,7 +19,7 @@ from typing import TYPE_CHECKING, Awaitable import asyncio from mautrix.bridge.commands import HelpSection, command_handler -from mautrix.types import SerializerError +from mautrix.types import Format, SerializerError from mautrix.util import utf16_surrogate from mautrix.util.formatter import ( EntityString, @@ -237,10 +237,10 @@ async def _edit_friend(evt: CommandEvent, add: bool) -> None: if not evt.args: await evt.reply(f"**Usage:** `$cmdprefix+sp {evt.command} `") return - formatted_body = evt.content.get("formatted_body") - if formatted_body: - arg = formatted_body[len(evt.command):].strip() - parsed = await MentionParser().parse(utf16_surrogate.add(arg)) + if evt.content.get("format", None) == Format.HTML and evt.content["formatted_body"]: + parsed = await MentionParser().parse(utf16_surrogate.add( + evt.content["formatted_body"][len(evt.command):].strip() + )) if not parsed.entities: await evt.reply("No user found") return