Spaces:
Runtime error
Runtime error
| # 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 |