mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-23 15:00:40 +01:00
09bdb88822
* Fix passport decryption failing at random times Sometimes a decrypted secret was being treated as b64 and therefore got decoded even further. Fix by decoding b64 right before call to decrypt so we have better control of when not to do it * Bot api 4.1 Telegram passport 1.1 Added support for middle names. Added support for translations for documents Add errors for translations for documents Added support for requesting names in the language of the user's country of residence Replaced the payload parameter with the new parameter nonce NOTE: Scope stuff is NOT implemented, as we wanna STRONGLY encourage users to use the telegram provided SDKs anyway (and not generate telegram auth links in their bot, but rather on a server) * Minor fixes * Add hash to EncryptedPassportElement For use with PassportElementErrorUnspecified apparently
156 lines
8.9 KiB
Python
156 lines
8.9 KiB
Python
''#!/usr/bin/env python
|
|
#
|
|
# A library that provides a Python interface to the Telegram Bot API
|
|
# Copyright (C) 2015-2018
|
|
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Lesser Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Lesser Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser Public License
|
|
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
|
"""A library that provides a Python interface to the Telegram Bot API"""
|
|
|
|
from .base import TelegramObject
|
|
from .user import User
|
|
from .files.chatphoto import ChatPhoto
|
|
from .chat import Chat
|
|
from .chatmember import ChatMember
|
|
from .files.photosize import PhotoSize
|
|
from .files.audio import Audio
|
|
from .files.voice import Voice
|
|
from .files.document import Document
|
|
from .files.animation import Animation
|
|
from .files.sticker import Sticker, StickerSet, MaskPosition
|
|
from .files.video import Video
|
|
from .files.contact import Contact
|
|
from .files.location import Location
|
|
from .files.venue import Venue
|
|
from .files.videonote import VideoNote
|
|
from .chataction import ChatAction
|
|
from .userprofilephotos import UserProfilePhotos
|
|
from .keyboardbutton import KeyboardButton
|
|
from .replymarkup import ReplyMarkup
|
|
from .replykeyboardmarkup import ReplyKeyboardMarkup
|
|
from .replykeyboardremove import ReplyKeyboardRemove
|
|
from .forcereply import ForceReply
|
|
from .error import TelegramError
|
|
from .files.inputfile import InputFile
|
|
from .files.file import File
|
|
from .parsemode import ParseMode
|
|
from .messageentity import MessageEntity
|
|
from .games.game import Game
|
|
from .games.callbackgame import CallbackGame
|
|
from .payment.shippingaddress import ShippingAddress
|
|
from .payment.orderinfo import OrderInfo
|
|
from .payment.successfulpayment import SuccessfulPayment
|
|
from .payment.invoice import Invoice
|
|
from .passport.credentials import EncryptedCredentials
|
|
from .passport.passportfile import PassportFile
|
|
from .passport.data import IdDocumentData, PersonalDetails, ResidentialAddress
|
|
from .passport.encryptedpassportelement import EncryptedPassportElement
|
|
from .passport.passportdata import PassportData
|
|
from .message import Message
|
|
from .callbackquery import CallbackQuery
|
|
from .choseninlineresult import ChosenInlineResult
|
|
from .inline.inlinekeyboardbutton import InlineKeyboardButton
|
|
from .inline.inlinekeyboardmarkup import InlineKeyboardMarkup
|
|
from .inline.inputmessagecontent import InputMessageContent
|
|
from .inline.inlinequery import InlineQuery
|
|
from .inline.inlinequeryresult import InlineQueryResult
|
|
from .inline.inlinequeryresultarticle import InlineQueryResultArticle
|
|
from .inline.inlinequeryresultaudio import InlineQueryResultAudio
|
|
from .inline.inlinequeryresultcachedaudio import InlineQueryResultCachedAudio
|
|
from .inline.inlinequeryresultcacheddocument import InlineQueryResultCachedDocument
|
|
from .inline.inlinequeryresultcachedgif import InlineQueryResultCachedGif
|
|
from .inline.inlinequeryresultcachedmpeg4gif import InlineQueryResultCachedMpeg4Gif
|
|
from .inline.inlinequeryresultcachedphoto import InlineQueryResultCachedPhoto
|
|
from .inline.inlinequeryresultcachedsticker import InlineQueryResultCachedSticker
|
|
from .inline.inlinequeryresultcachedvideo import InlineQueryResultCachedVideo
|
|
from .inline.inlinequeryresultcachedvoice import InlineQueryResultCachedVoice
|
|
from .inline.inlinequeryresultcontact import InlineQueryResultContact
|
|
from .inline.inlinequeryresultdocument import InlineQueryResultDocument
|
|
from .inline.inlinequeryresultgif import InlineQueryResultGif
|
|
from .inline.inlinequeryresultlocation import InlineQueryResultLocation
|
|
from .inline.inlinequeryresultmpeg4gif import InlineQueryResultMpeg4Gif
|
|
from .inline.inlinequeryresultphoto import InlineQueryResultPhoto
|
|
from .inline.inlinequeryresultvenue import InlineQueryResultVenue
|
|
from .inline.inlinequeryresultvideo import InlineQueryResultVideo
|
|
from .inline.inlinequeryresultvoice import InlineQueryResultVoice
|
|
from .inline.inlinequeryresultgame import InlineQueryResultGame
|
|
from .inline.inputtextmessagecontent import InputTextMessageContent
|
|
from .inline.inputlocationmessagecontent import InputLocationMessageContent
|
|
from .inline.inputvenuemessagecontent import InputVenueMessageContent
|
|
from .inline.inputcontactmessagecontent import InputContactMessageContent
|
|
from .payment.labeledprice import LabeledPrice
|
|
from .payment.shippingoption import ShippingOption
|
|
from .payment.precheckoutquery import PreCheckoutQuery
|
|
from .payment.shippingquery import ShippingQuery
|
|
from .webhookinfo import WebhookInfo
|
|
from .games.gamehighscore import GameHighScore
|
|
from .update import Update
|
|
from .files.inputmedia import (InputMedia, InputMediaVideo, InputMediaPhoto, InputMediaAnimation,
|
|
InputMediaAudio, InputMediaDocument)
|
|
from .bot import Bot
|
|
from .constants import (MAX_MESSAGE_LENGTH, MAX_CAPTION_LENGTH, SUPPORTED_WEBHOOK_PORTS,
|
|
MAX_FILESIZE_DOWNLOAD, MAX_FILESIZE_UPLOAD,
|
|
MAX_MESSAGES_PER_SECOND_PER_CHAT, MAX_MESSAGES_PER_SECOND,
|
|
MAX_MESSAGES_PER_MINUTE_PER_GROUP)
|
|
from .passport.passportelementerrors import (PassportElementError,
|
|
PassportElementErrorDataField,
|
|
PassportElementErrorFile,
|
|
PassportElementErrorFiles,
|
|
PassportElementErrorFrontSide,
|
|
PassportElementErrorReverseSide,
|
|
PassportElementErrorSelfie,
|
|
PassportElementErrorTranslationFile,
|
|
PassportElementErrorTranslationFiles,
|
|
PassportElementErrorUnspecified)
|
|
from .passport.credentials import (Credentials,
|
|
DataCredentials,
|
|
SecureData,
|
|
FileCredentials,
|
|
TelegramDecryptionError)
|
|
from .version import __version__ # flake8: noqa
|
|
|
|
__author__ = 'devs@python-telegram-bot.org'
|
|
|
|
__all__ = [
|
|
'Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult', 'CallbackQuery',
|
|
'Contact', 'Document', 'File', 'ForceReply', 'InlineKeyboardButton',
|
|
'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult', 'InlineQueryResult',
|
|
'InlineQueryResultArticle', 'InlineQueryResultAudio', 'InlineQueryResultCachedAudio',
|
|
'InlineQueryResultCachedDocument', 'InlineQueryResultCachedGif',
|
|
'InlineQueryResultCachedMpeg4Gif', 'InlineQueryResultCachedPhoto',
|
|
'InlineQueryResultCachedSticker', 'InlineQueryResultCachedVideo',
|
|
'InlineQueryResultCachedVoice', 'InlineQueryResultContact', 'InlineQueryResultDocument',
|
|
'InlineQueryResultGif', 'InlineQueryResultLocation', 'InlineQueryResultMpeg4Gif',
|
|
'InlineQueryResultPhoto', 'InlineQueryResultVenue', 'InlineQueryResultVideo',
|
|
'InlineQueryResultVoice', 'InlineQueryResultGame', 'InputContactMessageContent', 'InputFile',
|
|
'InputLocationMessageContent', 'InputMessageContent', 'InputTextMessageContent',
|
|
'InputVenueMessageContent', 'KeyboardButton', 'Location', 'EncryptedCredentials',
|
|
'PassportFile', 'EncryptedPassportElement', 'PassportData', 'Message', 'MessageEntity',
|
|
'ParseMode', 'PhotoSize', 'ReplyKeyboardRemove', 'ReplyKeyboardMarkup', 'ReplyMarkup',
|
|
'Sticker', 'TelegramError', 'TelegramObject', 'Update', 'User', 'UserProfilePhotos', 'Venue',
|
|
'Video', 'Voice', 'MAX_MESSAGE_LENGTH', 'MAX_CAPTION_LENGTH', 'SUPPORTED_WEBHOOK_PORTS',
|
|
'MAX_FILESIZE_DOWNLOAD', 'MAX_FILESIZE_UPLOAD', 'MAX_MESSAGES_PER_SECOND_PER_CHAT',
|
|
'MAX_MESSAGES_PER_SECOND', 'MAX_MESSAGES_PER_MINUTE_PER_GROUP', 'WebhookInfo', 'Animation',
|
|
'Game', 'GameHighScore', 'VideoNote', 'LabeledPrice', 'SuccessfulPayment', 'ShippingOption',
|
|
'ShippingAddress', 'PreCheckoutQuery', 'OrderInfo', 'Invoice', 'ShippingQuery', 'ChatPhoto',
|
|
'StickerSet', 'MaskPosition', 'CallbackGame', 'InputMedia', 'InputMediaPhoto',
|
|
'InputMediaVideo', 'PassportElementError', 'PassportElementErrorFile',
|
|
'PassportElementErrorReverseSide', 'PassportElementErrorFrontSide',
|
|
'PassportElementErrorFiles', 'PassportElementErrorDataField', 'PassportElementErrorFile',
|
|
'Credentials', 'DataCredentials', 'SecureData', 'FileCredentials', 'IdDocumentData',
|
|
'PersonalDetails', 'ResidentialAddress', 'InputMediaVideo', 'InputMediaAnimation',
|
|
'InputMediaAudio', 'InputMediaDocument', 'TelegramDecryptionError',
|
|
'PassportElementErrorSelfie', 'PassportElementErrorTranslationFile',
|
|
'PassportElementErrorTranslationFiles', 'PassportElementErrorUnspecified'
|
|
]
|