mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
* Backport RedisStorage, deep-linking * Allow prereleases for aioredis * Bump dependencies * Correctly skip Redis tests on Windows * Reformat tests code and bump Makefile
18 lines
434 B
Python
18 lines
434 B
Python
from typing import Any
|
|
from urllib.parse import urlencode, urljoin
|
|
|
|
|
|
def create_tg_link(link: str, **kwargs: Any) -> str:
|
|
url = f"tg://{link}"
|
|
if kwargs:
|
|
query = urlencode(kwargs)
|
|
url += f"?{query}"
|
|
return url
|
|
|
|
|
|
def create_telegram_link(uri: str, **kwargs: Any) -> str:
|
|
url = urljoin("https://t.me", uri)
|
|
if kwargs:
|
|
query = urlencode(query=kwargs)
|
|
url += f"?{query}"
|
|
return url
|