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
|
import asyncio
|
||||||
|
|
||||||
from mautrix.bridge.commands import HelpSection, command_handler
|
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 import utf16_surrogate
|
||||||
from mautrix.util.formatter import (
|
from mautrix.util.formatter import (
|
||||||
EntityString,
|
EntityString,
|
||||||
@ -237,10 +237,10 @@ async def _edit_friend(evt: CommandEvent, add: bool) -> None:
|
|||||||
if not evt.args:
|
if not evt.args:
|
||||||
await evt.reply(f"**Usage:** `$cmdprefix+sp {evt.command} <KakaoTalk ID|Matrix user ID>`")
|
await evt.reply(f"**Usage:** `$cmdprefix+sp {evt.command} <KakaoTalk ID|Matrix user ID>`")
|
||||||
return
|
return
|
||||||
formatted_body = evt.content.get("formatted_body")
|
if evt.content.get("format", None) == Format.HTML and evt.content["formatted_body"]:
|
||||||
if formatted_body:
|
parsed = await MentionParser().parse(utf16_surrogate.add(
|
||||||
arg = formatted_body[len(evt.command):].strip()
|
evt.content["formatted_body"][len(evt.command):].strip()
|
||||||
parsed = await MentionParser().parse(utf16_surrogate.add(arg))
|
))
|
||||||
if not parsed.entities:
|
if not parsed.entities:
|
||||||
await evt.reply("No user found")
|
await evt.reply("No user found")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user