mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Reformat code. Use rel imports.
This commit is contained in:
parent
ab7934f333
commit
4dba8f534e
21 changed files with 44 additions and 46 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from aiogram.types.user import User
|
||||
from . import Deserializable, deserialize
|
||||
from . import Deserializable
|
||||
from .user import User
|
||||
|
||||
|
||||
class ChatMember(Deserializable):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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('/')
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from . import Deserializable, deserialize
|
||||
from . import Deserializable
|
||||
from .user import User
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from aiogram.types.shipping_address import ShippingAddress
|
||||
from . import Deserializable
|
||||
from .shipping_address import ShippingAddress
|
||||
|
||||
|
||||
class OrderInfo(Deserializable):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from aiogram.types.photo_size import PhotoSize
|
||||
from . import Deserializable
|
||||
from .photo_size import PhotoSize
|
||||
|
||||
|
||||
class Sticker(Deserializable):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from aiogram.types.order_info import OrderInfo
|
||||
from . import Deserializable
|
||||
from .order_info import OrderInfo
|
||||
|
||||
|
||||
class SuccessfulPayment(Deserializable):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from aiogram.types.photo_size import PhotoSize
|
||||
from . import Deserializable
|
||||
from .photo_size import PhotoSize
|
||||
|
||||
|
||||
class UserProfilePhotos(Deserializable):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from aiogram.types.location import Location
|
||||
from . import Deserializable
|
||||
from .location import Location
|
||||
|
||||
|
||||
class Venue(Deserializable):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from aiogram.types.photo_size import PhotoSize
|
||||
from . import Deserializable
|
||||
from .photo_size import PhotoSize
|
||||
|
||||
|
||||
class Video(Deserializable):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from .photo_size import PhotoSize
|
||||
from . import Deserializable
|
||||
from .photo_size import PhotoSize
|
||||
|
||||
|
||||
class VideoNote(Deserializable):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue