This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from pathlib import Path | |
from typing import Any, Callable, Dict, Optional, Self, cast | |
import aiosqlite | |
from aiogram.fsm.state import State | |
from aiogram.fsm.storage.base import ( | |
BaseStorage, | |
DefaultKeyBuilder, | |
KeyBuilder, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple HTML -> Telegram entity parser. | |
""" | |
from collections import deque | |
from html import escape | |
from html.parser import HTMLParser | |
from typing import Iterable, Tuple, List | |
from telethon.helpers import add_surrogate, del_surrogate, within_surrogate, strip_text | |
from telethon.tl import TLObject |