diff --git a/aiogram/api.py b/aiogram/api.py index 10e72326..1d4a2c14 100644 --- a/aiogram/api.py +++ b/aiogram/api.py @@ -1,5 +1,5 @@ -from aiogram import API_URL, log -from aiogram.exceptions import ValidationError, TelegramAPIError +from . import API_URL, log +from .exceptions import ValidationError, TelegramAPIError def check_token(token): diff --git a/aiogram/bot.py b/aiogram/bot.py index 492747d3..97c5e90b 100644 --- a/aiogram/bot.py +++ b/aiogram/bot.py @@ -2,11 +2,10 @@ import asyncio import aiohttp -from aiogram.types.message import Message -from aiogram.utils.payload import generate_payload from . import api from .api import ApiMethods from .types.chat import Chat +from .types.message import Message from .types.update import Update from .types.user import User from .utils.payload import generate_payload diff --git a/aiogram/types/animation.py b/aiogram/types/animation.py index f4021613..3e2becc0 100644 --- a/aiogram/types/animation.py +++ b/aiogram/types/animation.py @@ -1,5 +1,5 @@ -from aiogram.types.photo_size import PhotoSize -from . import Deserializable, deserialize +from . import Deserializable +from .photo_size import PhotoSize class Animation(Deserializable): diff --git a/aiogram/types/callback_query.py b/aiogram/types/callback_query.py index e5efa496..b012898c 100644 --- a/aiogram/types/callback_query.py +++ b/aiogram/types/callback_query.py @@ -1,6 +1,6 @@ -from aiogram.types.message import Message -from aiogram.types.user import User -from . import Deserializable, deserialize +from . import Deserializable +from .message import Message +from .user import User class CallbackQuery(Deserializable): diff --git a/aiogram/types/chat_member.py b/aiogram/types/chat_member.py index be27163e..9f973cb9 100644 --- a/aiogram/types/chat_member.py +++ b/aiogram/types/chat_member.py @@ -1,5 +1,5 @@ -from aiogram.types.user import User -from . import Deserializable, deserialize +from . import Deserializable +from .user import User class ChatMember(Deserializable): diff --git a/aiogram/types/chosen_inline_result.py b/aiogram/types/chosen_inline_result.py index b72d8504..75655fa0 100644 --- a/aiogram/types/chosen_inline_result.py +++ b/aiogram/types/chosen_inline_result.py @@ -1,6 +1,6 @@ -from aiogram.types.location import Location -from aiogram.types.user import User from . import Deserializable +from .location import Location +from .user import User class ChosenInlineResult(Deserializable): diff --git a/aiogram/types/document.py b/aiogram/types/document.py index 5161455e..e89a988b 100644 --- a/aiogram/types/document.py +++ b/aiogram/types/document.py @@ -1,5 +1,5 @@ -from aiogram.types.photo_size import PhotoSize -from . import Deserializable, deserialize +from . import Deserializable +from .photo_size import PhotoSize class Document(Deserializable): diff --git a/aiogram/types/game.py b/aiogram/types/game.py index 351e73b2..b1c17917 100644 --- a/aiogram/types/game.py +++ b/aiogram/types/game.py @@ -1,7 +1,7 @@ -from aiogram.types.animation import Animation -from aiogram.types.message_entity import MessageEntity -from aiogram.types.photo_size import PhotoSize from . import Deserializable +from .animation import Animation +from .message_entity import MessageEntity +from .photo_size import PhotoSize class Game(Deserializable): diff --git a/aiogram/types/inline_query.py b/aiogram/types/inline_query.py index b63e062c..1f51afac 100644 --- a/aiogram/types/inline_query.py +++ b/aiogram/types/inline_query.py @@ -1,6 +1,6 @@ -from aiogram.types.location import Location -from aiogram.types.user import User from . import Deserializable +from .location import Location +from .user import User class InlineQuery(Deserializable): diff --git a/aiogram/types/message.py b/aiogram/types/message.py index abaa09c7..59ec36d7 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -21,12 +21,12 @@ from .voice import Voice class Message(Deserializable): - def __init__(self, message_id, from_user, date, chat, forward_from, forward_from_chat, - forward_from_message_id, forward_date, reply_to_message, edit_date, text, entities, audio, document, - game, photo, sticker, video, voice, video_note, new_chat_members, caption, contact, location, venue, - left_chat_member, new_chat_title, new_chat_photo, delete_chat_photo, - group_chat_created, supergroup_chat_created, channel_chat_created, migrate_to_chat_id, - migrate_from_chat_id, pinned_message, invoice, successful_payment, content_type): + def __init__(self, message_id, from_user, date, chat, forward_from, forward_from_chat, forward_from_message_id, + forward_date, reply_to_message, edit_date, text, entities, audio, document, game, photo, sticker, + video, voice, video_note, new_chat_members, caption, contact, location, venue, left_chat_member, + new_chat_title, new_chat_photo, delete_chat_photo, group_chat_created, supergroup_chat_created, + channel_chat_created, migrate_to_chat_id, migrate_from_chat_id, pinned_message, invoice, + successful_payment, content_type): self.message_id: int = message_id self.from_user: User = from_user self.date: datetime.datetime = date @@ -140,13 +140,12 @@ class Message(Deserializable): else: content_type = ContentType.UNKNOWN - return Message(message_id, from_user, date, chat, forward_from, forward_from_chat, - forward_from_message_id, forward_date, reply_to_message, edit_date, text, entities, audio, - document, game, photo, sticker, video, voice, video_note, new_chat_members, caption, contact, - location, venue, left_chat_member, new_chat_title, new_chat_photo, - delete_chat_photo, group_chat_created, supergroup_chat_created, channel_chat_created, - migrate_to_chat_id, migrate_from_chat_id, pinned_message, invoice, successful_payment, - content_type) + return Message(message_id, from_user, date, chat, forward_from, forward_from_chat, forward_from_message_id, + forward_date, reply_to_message, edit_date, text, entities, audio, document, game, photo, sticker, + video, voice, video_note, new_chat_members, caption, contact, location, venue, left_chat_member, + new_chat_title, new_chat_photo, delete_chat_photo, group_chat_created, supergroup_chat_created, + channel_chat_created, migrate_to_chat_id, migrate_from_chat_id, pinned_message, invoice, + successful_payment, content_type) def is_command(self): return self.text and self.text.startswith('/') diff --git a/aiogram/types/message_entity.py b/aiogram/types/message_entity.py index 29c6bba3..3897a2d2 100644 --- a/aiogram/types/message_entity.py +++ b/aiogram/types/message_entity.py @@ -1,4 +1,4 @@ -from . import Deserializable, deserialize +from . import Deserializable from .user import User diff --git a/aiogram/types/order_info.py b/aiogram/types/order_info.py index a3df4886..6f2b5a44 100644 --- a/aiogram/types/order_info.py +++ b/aiogram/types/order_info.py @@ -1,5 +1,5 @@ -from aiogram.types.shipping_address import ShippingAddress from . import Deserializable +from .shipping_address import ShippingAddress class OrderInfo(Deserializable): diff --git a/aiogram/types/pre_checkout_query.py b/aiogram/types/pre_checkout_query.py index e066325d..00500e4e 100644 --- a/aiogram/types/pre_checkout_query.py +++ b/aiogram/types/pre_checkout_query.py @@ -1,6 +1,6 @@ -from aiogram.types.order_info import OrderInfo -from aiogram.types.user import User from . import Deserializable +from .order_info import OrderInfo +from .user import User class PreCheckoutQuery(Deserializable): diff --git a/aiogram/types/shipping_query.py b/aiogram/types/shipping_query.py index 858ed193..0a4d70ab 100644 --- a/aiogram/types/shipping_query.py +++ b/aiogram/types/shipping_query.py @@ -1,6 +1,6 @@ -from aiogram.types.shipping_address import ShippingAddress -from aiogram.types.user import User from . import Deserializable +from .shipping_address import ShippingAddress +from .user import User class ShippingQuery(Deserializable): diff --git a/aiogram/types/sticker.py b/aiogram/types/sticker.py index 7d602ff2..5a9c487b 100644 --- a/aiogram/types/sticker.py +++ b/aiogram/types/sticker.py @@ -1,5 +1,5 @@ -from aiogram.types.photo_size import PhotoSize from . import Deserializable +from .photo_size import PhotoSize class Sticker(Deserializable): diff --git a/aiogram/types/successful_payment.py b/aiogram/types/successful_payment.py index a8896a35..542e56f4 100644 --- a/aiogram/types/successful_payment.py +++ b/aiogram/types/successful_payment.py @@ -1,5 +1,5 @@ -from aiogram.types.order_info import OrderInfo from . import Deserializable +from .order_info import OrderInfo class SuccessfulPayment(Deserializable): diff --git a/aiogram/types/update.py b/aiogram/types/update.py index c4622d1a..b6aeda86 100644 --- a/aiogram/types/update.py +++ b/aiogram/types/update.py @@ -8,7 +8,7 @@ from .message import Message class Update(Deserializable): - def __init__(self, update_id, message, edited_message, channel_post, edited_channel_post, inline_query, + def __init__(self, update_id, message, edited_maiogramessage, channel_post, edited_channel_post, inline_query, chosen_inline_result, callback_query, shipping_query, pre_checkout_query): self.update_id: int = update_id self.message: Message = message diff --git a/aiogram/types/user_profile_photos.py b/aiogram/types/user_profile_photos.py index c66d3f9d..627a6799 100644 --- a/aiogram/types/user_profile_photos.py +++ b/aiogram/types/user_profile_photos.py @@ -1,5 +1,5 @@ -from aiogram.types.photo_size import PhotoSize from . import Deserializable +from .photo_size import PhotoSize class UserProfilePhotos(Deserializable): diff --git a/aiogram/types/venue.py b/aiogram/types/venue.py index 3fdcd2fd..7de96d71 100644 --- a/aiogram/types/venue.py +++ b/aiogram/types/venue.py @@ -1,5 +1,5 @@ -from aiogram.types.location import Location from . import Deserializable +from .location import Location class Venue(Deserializable): diff --git a/aiogram/types/video.py b/aiogram/types/video.py index d7efdae7..f01358d7 100644 --- a/aiogram/types/video.py +++ b/aiogram/types/video.py @@ -1,5 +1,5 @@ -from aiogram.types.photo_size import PhotoSize from . import Deserializable +from .photo_size import PhotoSize class Video(Deserializable): diff --git a/aiogram/types/video_note.py b/aiogram/types/video_note.py index 311e9217..6ecdc542 100644 --- a/aiogram/types/video_note.py +++ b/aiogram/types/video_note.py @@ -1,5 +1,5 @@ -from .photo_size import PhotoSize from . import Deserializable +from .photo_size import PhotoSize class VideoNote(Deserializable):