mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-14 19:00:23 +00:00
Reformat code.
This commit is contained in:
parent
b7bf22bb77
commit
92d3d86a18
42 changed files with 73 additions and 10 deletions
|
|
@ -1,6 +1,5 @@
|
|||
from .utils.versions import Version, Stage
|
||||
from .bot import Bot
|
||||
|
||||
from .utils.versions import Version, Stage
|
||||
|
||||
VERSION = Version(0, 3, 5, stage=Stage.DEV, build=0)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import typing
|
||||
|
||||
from aiogram.dispatcher import BaseStorage
|
||||
from ...dispatcher import BaseStorage
|
||||
|
||||
|
||||
class MemoryStorage(BaseStorage):
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import typing
|
|||
|
||||
import aioredis
|
||||
|
||||
from aiogram.utils import json
|
||||
from ...dispatcher.storage import BaseStorage
|
||||
from ...utils import json
|
||||
|
||||
|
||||
class RedisStorage(BaseStorage):
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class Dispatcher:
|
|||
if storage is None:
|
||||
storage = DisabledStorage()
|
||||
|
||||
self.bot: 'Bot' = bot
|
||||
self.bot: Bot = bot
|
||||
self.loop = loop
|
||||
self.storage = storage
|
||||
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ class BaseResponse:
|
|||
"""
|
||||
Base class for webhook responses.
|
||||
"""
|
||||
|
||||
@property
|
||||
def method(self) -> str:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from . import base
|
||||
from .animation import Animation
|
||||
from .audio import Audio
|
||||
from .callback_query import CallbackQuery
|
||||
|
|
@ -48,8 +49,6 @@ from .video_note import VideoNote
|
|||
from .voice import Voice
|
||||
from .webhook_info import WebhookInfo
|
||||
|
||||
from . import base
|
||||
|
||||
__all__ = [
|
||||
'base',
|
||||
'Animation',
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class Animation(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#animation
|
||||
"""
|
||||
|
||||
def __init__(self, file_id, thumb, file_name, mime_type, file_size):
|
||||
self.file_id: str = file_id
|
||||
self.thumb: PhotoSize = thumb
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Audio(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#audio
|
||||
"""
|
||||
|
||||
def __init__(self, file_id, duration, performer, title, mime_type, file_size):
|
||||
self.file_id: str = file_id
|
||||
self.duration: int = duration
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class CallbackQuery(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#callbackquery
|
||||
"""
|
||||
|
||||
def __init__(self, id, from_user, message, inline_message_id, chat_instance, data, game_short_name):
|
||||
self.id: int = id
|
||||
self.from_user: User = from_user
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class ChosenInlineResult(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#choseninlineresult
|
||||
"""
|
||||
|
||||
def __init__(self, result_id, from_user, location, inline_message_id, query):
|
||||
self.result_id: str = result_id
|
||||
self.from_user: User = from_user
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Contact(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#contact
|
||||
"""
|
||||
|
||||
def __init__(self, phone_number, first_name, last_name, user_id):
|
||||
self.phone_number: str = phone_number
|
||||
self.first_name: str = first_name
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class Document(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#document
|
||||
"""
|
||||
|
||||
def __init__(self, file_id, thumb, file_name, mime_type, file_size):
|
||||
self.file_id: str = file_id
|
||||
self.thumb: PhotoSize = thumb
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class File(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#file
|
||||
"""
|
||||
|
||||
def __init__(self, file_id, file_size, file_path):
|
||||
self.file_id: str = file_id
|
||||
self.file_size: int = file_size
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class ForceReply(Serializable):
|
|||
|
||||
https://core.telegram.org/bots/api#forcereply
|
||||
"""
|
||||
|
||||
def __init__(self, selective=None):
|
||||
self.selective = selective
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class Game(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#game
|
||||
"""
|
||||
|
||||
def __init__(self, title, description, photo, text, text_entities, animation):
|
||||
self.title = title
|
||||
self.description = description
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class GameHighScore(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#gamehighscore
|
||||
"""
|
||||
|
||||
def __init__(self, position, user, score):
|
||||
self.position: int = position
|
||||
self.user: User = user
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class InlineKeyboardMarkup(Serializable):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinekeyboardmarkup
|
||||
"""
|
||||
|
||||
def __init__(self, row_width=3):
|
||||
self.row_width = row_width
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ class InlineKeyboardButton(Serializable):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinekeyboardbutton
|
||||
"""
|
||||
|
||||
def __init__(self, text, url=None, callback_data=None, switch_inline_query=None,
|
||||
switch_inline_query_current_chat=None, callback_game=None, pay=None):
|
||||
self.text = text
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class InlineQuery(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequery
|
||||
"""
|
||||
|
||||
def __init__(self, id, from_user, location, query, offset):
|
||||
self.id: int = id
|
||||
self.from_user: User = from_user
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class InputMessageContent(Serializable):
|
|||
:class:`aiogram.types.InputVenueMessageContent`
|
||||
:class:`aiogram.types.InputContactMessageContent`
|
||||
"""
|
||||
|
||||
def to_json(self):
|
||||
return {k: v.to_json() if hasattr(v, 'to_json') else v for k, v in self.__dict__.items() if
|
||||
v is not None and not k.startswith('_')}
|
||||
|
|
@ -74,6 +75,7 @@ class InlineQueryResultArticle(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultarticle
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, title: str, input_message_content: InputMessageContent,
|
||||
reply_markup: InlineKeyboardMarkup = None, url: str = None, hide_url: bool = None,
|
||||
description: str = None, thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
|
||||
|
|
@ -99,6 +101,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultphoto
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, photo_url: str, thumb_url: str, photo_width: int = None,
|
||||
photo_height: int = None, title: str = None, description: str = None, caption: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
|
|
@ -126,6 +129,7 @@ class InlineQueryResultGif(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultgif
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, gif_url: str, thumb_url: str, gif_width: int = None, gif_height: int = None,
|
||||
gif_duration: int = None, title: str = None, caption: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
|
|
@ -153,6 +157,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, mpeg4_url: str, thumb_url: str, mpeg4_width: int = None,
|
||||
mpeg4_height: int = None, mpeg4_duration: int = None, title: str = None, caption: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
|
|
@ -178,6 +183,7 @@ class InlineQueryResultVideo(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultvideo
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, video_url: str, mime_type: str, thumb_url: str, title: str,
|
||||
caption: str = None, video_width: int = None, video_height: int = None, video_duration: int = None,
|
||||
description: str = None, reply_markup: InlineKeyboardMarkup = None,
|
||||
|
|
@ -204,6 +210,7 @@ class InlineQueryResultAudio(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultaudio
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, audio_url: str, title: str, caption: str = None, performer: str = None,
|
||||
audio_duration: int = None, reply_markup: InlineKeyboardMarkup = None,
|
||||
input_message_content: InputMessageContent = None):
|
||||
|
|
@ -229,6 +236,7 @@ class InlineQueryResultVoice(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultvoice
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, voice_url: str, title: str, caption: str = None, voice_duration: int = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
self.type = 'voice'
|
||||
|
|
@ -250,6 +258,7 @@ class InlineQueryResultDocument(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultdocument
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, title: str, document_url: str, mime_type: str, caption: str = None,
|
||||
description: str = None, reply_markup: InlineKeyboardMarkup = None,
|
||||
input_message_content: InputMessageContent = None, thumb_url: str = None, thumb_width: int = None,
|
||||
|
|
@ -276,6 +285,7 @@ class InlineQueryResultLocation(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultlocation
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, latitude: float, longitude: float, title: str,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None,
|
||||
thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
|
||||
|
|
@ -299,6 +309,7 @@ class InlineQueryResultVenue(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultvenue
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, latitude: float, longitude: float, title: str, address: str,
|
||||
foursquare_id: str = None, reply_markup: InlineKeyboardMarkup = None,
|
||||
input_message_content: InputMessageContent = None, thumb_url: str = None, thumb_width: int = None,
|
||||
|
|
@ -328,6 +339,7 @@ class InlineQueryResultContact(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcontact
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, phone_number: str, first_name: str, last_name: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None,
|
||||
thumb_url: str = None, thumb_width: int = None, thumb_height: int = None):
|
||||
|
|
@ -349,6 +361,7 @@ class InlineQueryResultGame(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultgame
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, game_short_name: str, reply_markup: InlineKeyboardMarkup = None):
|
||||
self.type = 'game'
|
||||
self.id: str = id
|
||||
|
|
@ -367,6 +380,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcachedphoto
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, photo_file_id: str, title: str = None, description: str = None,
|
||||
caption: str = None, reply_markup: InlineKeyboardMarkup = None,
|
||||
input_message_content: InputMessageContent = None):
|
||||
|
|
@ -391,6 +405,7 @@ class InlineQueryResultCachedGif(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcachedgif
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, gif_file_id: str, title: str = None, caption: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
self.type = 'gif'
|
||||
|
|
@ -413,6 +428,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, mpeg4_file_id: str, title: str = None, caption: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
self.type = 'mpeg4_gif'
|
||||
|
|
@ -435,6 +451,7 @@ class InlineQueryResultCachedSticker(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcachedsticker
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, sticker_file_id: str, reply_markup: InlineKeyboardMarkup = None,
|
||||
input_message_content: InputMessageContent = None):
|
||||
self.type = 'sticker'
|
||||
|
|
@ -455,6 +472,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcacheddocument
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, title: str, document_file_id: str, description: str = None,
|
||||
caption: str = None, reply_markup: InlineKeyboardMarkup = None,
|
||||
input_message_content: InputMessageContent = None):
|
||||
|
|
@ -477,6 +495,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcachedvideo
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, video_file_id: str, title: str, description: str = None, caption: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
self.type = 'video'
|
||||
|
|
@ -500,6 +519,7 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcachedvoice
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, voice_file_id: str, title: str, caption: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
self.type = 'voice'
|
||||
|
|
@ -521,6 +541,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
|
|||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultcachedaudio
|
||||
"""
|
||||
|
||||
def __init__(self, id: str, audio_file_id: str, caption: str = None,
|
||||
reply_markup: InlineKeyboardMarkup = None, input_message_content: InputMessageContent = None):
|
||||
self.type = 'audio'
|
||||
|
|
@ -537,6 +558,7 @@ class InputTextMessageContent(InputMessageContent):
|
|||
|
||||
https://core.telegram.org/bots/api#inputtextmessagecontent
|
||||
"""
|
||||
|
||||
def __init__(self, message_text: str, parse_mode: str = None, disable_web_page_preview: bool = None):
|
||||
self.message_text: str = message_text
|
||||
self.parse_mode: str = parse_mode
|
||||
|
|
@ -549,6 +571,7 @@ class InputLocationMessageContent(InputMessageContent):
|
|||
|
||||
https://core.telegram.org/bots/api#inputlocationmessagecontent
|
||||
"""
|
||||
|
||||
def __init__(self, latitude: float, longitude: float):
|
||||
self.latitude: float = latitude
|
||||
self.longitude: float = longitude
|
||||
|
|
@ -560,6 +583,7 @@ class InputVenueMessageContent(InputMessageContent):
|
|||
|
||||
https://core.telegram.org/bots/api#inputvenuemessagecontent
|
||||
"""
|
||||
|
||||
def __init__(self, latitude: float, longitude: float, title: str, address: str, foursquare_id: str = None):
|
||||
self.latitude: float = latitude
|
||||
self.longitude: float = longitude
|
||||
|
|
@ -574,6 +598,7 @@ class InputContactMessageContent(InputMessageContent):
|
|||
|
||||
https://core.telegram.org/bots/api#inputcontactmessagecontent
|
||||
"""
|
||||
|
||||
def __init__(self, phone_number: str, first_name: str, last_name: str = None):
|
||||
self.phone_number: str = phone_number
|
||||
self.first_name: str = first_name
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Invoice(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#invoice
|
||||
"""
|
||||
|
||||
def __init__(self, title, description, start_parameter, currency, total_amount):
|
||||
self.title: str = title
|
||||
self.description: str = description
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class LabeledPrice(Serializable):
|
|||
|
||||
https://core.telegram.org/bots/api#labeledprice
|
||||
"""
|
||||
|
||||
def __init__(self, label, amount):
|
||||
self.label = label
|
||||
self.amount = amount
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Location(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#location
|
||||
"""
|
||||
|
||||
def __init__(self, longitude, latitude):
|
||||
self.longitude = longitude
|
||||
self.latitude = latitude
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class OrderInfo(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#orderinfo
|
||||
"""
|
||||
|
||||
def __init__(self, name, phone_number, email, shipping_address):
|
||||
self.name: str = name
|
||||
self.phone_number: str = phone_number
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class PhotoSize(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#photosize
|
||||
"""
|
||||
|
||||
def __init__(self, file_id, width, height, file_size):
|
||||
self.file_id: str = file_id
|
||||
self.width: int = width
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class PreCheckoutQuery(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#precheckoutquery
|
||||
"""
|
||||
|
||||
def __init__(self, id, from_user, currency, total_amount, invoice_payload, shipping_option_id, order_info):
|
||||
self.id: str = id
|
||||
self.from_user: User = from_user
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class ReplyKeyboardMarkup(Serializable):
|
|||
|
||||
https://core.telegram.org/bots/api#replykeyboardmarkup
|
||||
"""
|
||||
|
||||
def __init__(self, resize_keyboard=None, one_time_keyboard=None, selective=None, row_width=3):
|
||||
self.resize_keyboard = resize_keyboard
|
||||
self.one_time_keyboard = one_time_keyboard
|
||||
|
|
@ -56,6 +57,7 @@ class KeyboardButton(Serializable):
|
|||
|
||||
https://core.telegram.org/bots/api#keyboardbutton
|
||||
"""
|
||||
|
||||
def __init__(self, text, request_contact=None, request_location=None):
|
||||
self.text = text
|
||||
self.request_contact = request_contact
|
||||
|
|
@ -77,6 +79,7 @@ class ReplyKeyboardRemove(Serializable):
|
|||
|
||||
https://core.telegram.org/bots/api#replykeyboardremove
|
||||
"""
|
||||
|
||||
def __init__(self, selective=None):
|
||||
self.selective = selective
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class ResponseParameters(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#responseparameters
|
||||
"""
|
||||
|
||||
def __init__(self, migrate_to_chat_id, retry_after):
|
||||
self.migrate_to_chat_id = migrate_to_chat_id
|
||||
self.retry_after = retry_after
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class ShippingAddress(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#shippingaddress
|
||||
"""
|
||||
|
||||
def __init__(self, country_code, state, city, street_line1, street_line2, post_code):
|
||||
self.country_code: str = country_code
|
||||
self.state: str = state
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class ShippingOption(Serializable):
|
|||
|
||||
https://core.telegram.org/bots/api#shippingoption
|
||||
"""
|
||||
|
||||
def __init__(self, id, title, prices):
|
||||
self.id = id
|
||||
self.title = title
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class ShippingQuery(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#shippingquery
|
||||
"""
|
||||
|
||||
def __init__(self, id, from_user, invoice_payload, shipping_address):
|
||||
self.id: str = id
|
||||
self.from_user: User = from_user
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from .base import Deserializable
|
||||
from .photo_size import PhotoSize
|
||||
from .mask_position import MaskPosition
|
||||
from .photo_size import PhotoSize
|
||||
|
||||
|
||||
class Sticker(Deserializable):
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class SuccessfulPayment(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#successfulpayment
|
||||
"""
|
||||
|
||||
def __init__(self, currency, total_amount, invoice_payload, shipping_option_id, order_info,
|
||||
telegram_payment_charge_id, provider_payment_charge_id):
|
||||
self.currency: str = currency
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class User(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#user
|
||||
"""
|
||||
|
||||
def __init__(self, id, first_name, last_name, username, language_code):
|
||||
self.id: int = id
|
||||
self.first_name: str = first_name
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class UserProfilePhotos(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#userprofilephotos
|
||||
"""
|
||||
|
||||
def __init__(self, total_count, photos):
|
||||
self.total_count: int = total_count
|
||||
self.photos: [PhotoSize] = photos
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class Venue(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#venue
|
||||
"""
|
||||
|
||||
def __init__(self, location, title, address, foursquare_id):
|
||||
self.location: Location = location
|
||||
self.title: str = title
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class Video(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#video
|
||||
"""
|
||||
|
||||
def __init__(self, file_id, width, height, duration, thumb, mime_type, file_size):
|
||||
self.file_id: str = file_id
|
||||
self.width: int = width
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class VideoNote(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#videonote
|
||||
"""
|
||||
|
||||
def __init__(self, file_id, length, duration, thumb, file_size):
|
||||
self.file_id: str = file_id
|
||||
self.length: int = length
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Voice(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#voice
|
||||
"""
|
||||
|
||||
def __init__(self, file_id, duration, mime_type, file_size):
|
||||
self.file_id: str = file_id
|
||||
self.duration: int = duration
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import datetime
|
||||
|
||||
from .base import Deserializable
|
||||
|
||||
|
||||
|
|
@ -9,6 +7,7 @@ class WebhookInfo(Deserializable):
|
|||
|
||||
https://core.telegram.org/bots/api#webhookinfo
|
||||
"""
|
||||
|
||||
def __init__(self, url, has_custom_certificate, pending_update_count, last_error_date, last_error_message,
|
||||
max_connections, allowed_updates):
|
||||
self.url: str = url
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
from .deprecated import warn_deprecated
|
||||
|
||||
try:
|
||||
import emoji
|
||||
|
||||
warn_deprecated('Use emoji module instead that util')
|
||||
except ImportError:
|
||||
raise ImportError('Need install "emoji" module.')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
try:
|
||||
import ujson as json
|
||||
|
||||
IS_UJSON = True
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
IS_UJSON = False
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import subprocess
|
|||
|
||||
from .helper import Helper, HelperMode, Item
|
||||
|
||||
|
||||
# Based on https://github.com/django/django/blob/master/django/utils/version.py
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue