Friend cmds: Use same mention formatting as outbound message formatter
This commit is contained in:
parent
a49e2768a3
commit
37101f42c1
@ -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} <KakaoTalk ID|Matrix user ID>`")
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user