Spaces:
Runtime error
Runtime error
File size: 492 Bytes
33b99cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# PATH: bot/youtube/link_parser.py
from __future__ import annotations
from typing import Tuple, Union
from bot.core.link_parser import ChatRef, parse_link
def parse_telegram_link(link: str) -> Tuple[ChatRef, int]:
"""
handlers.py expects this to raise on bad links.
Returns: (chat_ref, msg_id)
chat_ref: int (-100... for private channels) or username str
"""
out = parse_link(link)
if not out:
raise ValueError("invalid_telegram_link")
return out |