Skip to content

Instantly share code, notes, and snippets.

View YouKnow-sys's full-sized avatar
:shipit:

YouKnow YouKnow-sys

:shipit:
View GitHub Profile
@YouKnow-sys
YouKnow-sys / async_sqlite_storage.py
Last active December 2, 2024 19:50
A async sqlite storage for aiogram
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,
@YouKnow-sys
YouKnow-sys / custom_html_parser.py
Created June 21, 2024 15:01
Html parser/unparser with spoiler and custom emoji support for telethon
"""
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