async def METHOD_NAME(event):
    old_entities = event.message.entities or []
    parser = partial(parse, old_entities=old_entities)
    if event.raw_text:
        message, msg_entities = await event.client._parse_message_text(
            event.raw_text, parser
        )
        if len(old_entities) >= len(msg_entities) and event.raw_text == message:
            return
        await event.client(
            EditMessageRequest(
                peer=await event.get_input_chat(),
                id=event.message.id,
                message=message,
                no_webpage=not bool(event.message.media),
                entities=msg_entities,
            )
        )
        raise events.StopPropagation