-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Dmitry Vasiliev edited this page Aug 28, 2024
·
2 revisions
generate_secret_key(token: str) → bytesGenerates a secret key from a Telegram token.
Links: https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app
Args:
-
token: Telegram Bot Token
Returns:
-
bytes: secret key
Represents a Telegram user.
Links: https://core.telegram.org/bots/webapps#webappuser
__init__(
id: int,
first_name: str,
is_bot: bool | None = None,
last_name: str | None = None,
username: str | None = None,
language_code: str | None = None,
is_premium: bool | None = None,
added_to_attachment_menu: bool | None = None,
allows_write_to_pm: bool | None = None,
photo_url: str | None = None
) → None__init__(secret: bytes)verify_token(token: str) → TelegramUserVerifies the data using the method from documentation. Returns Telegram user if data is valid.
Links: https://core.telegram.org/bots/webapps#validating-data-received-via-the-mini-app
Args:
-
hash_: hash from init data -
token: init data from webapp
Returns:
-
TelegramUser: Telegram user if token is valid
Raises:
-
InvalidInitDataError: if the token is invalid
This file was automatically generated via lazydocs.