mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge pull request #294 from aiogram/dev-2.x-api-4.7
Updated API 4.7 for dev-2.x branch
This commit is contained in:
commit
a565251d4e
11 changed files with 300 additions and 133 deletions
|
|
@ -3,6 +3,7 @@ from . import fields
|
|||
from .animation import Animation
|
||||
from .audio import Audio
|
||||
from .auth_widget_data import AuthWidgetData
|
||||
from .bot_command import BotCommand
|
||||
from .callback_game import CallbackGame
|
||||
from .callback_query import CallbackQuery
|
||||
from .chat import Chat, ChatActions, ChatType
|
||||
|
|
@ -11,6 +12,7 @@ from .chat_permissions import ChatPermissions
|
|||
from .chat_photo import ChatPhoto
|
||||
from .chosen_inline_result import ChosenInlineResult
|
||||
from .contact import Contact
|
||||
from .dice import Dice
|
||||
from .document import Document
|
||||
from .encrypted_credentials import EncryptedCredentials
|
||||
from .encrypted_passport_element import EncryptedPassportElement
|
||||
|
|
@ -69,6 +71,7 @@ __all__ = (
|
|||
'Animation',
|
||||
'Audio',
|
||||
'AuthWidgetData',
|
||||
'BotCommand',
|
||||
'CallbackGame',
|
||||
'CallbackQuery',
|
||||
'Chat',
|
||||
|
|
@ -81,6 +84,7 @@ __all__ = (
|
|||
'Contact',
|
||||
'ContentType',
|
||||
'ContentTypes',
|
||||
'Dice',
|
||||
'Document',
|
||||
'EncryptedCredentials',
|
||||
'EncryptedPassportElement',
|
||||
|
|
|
|||
15
aiogram/types/bot_command.py
Normal file
15
aiogram/types/bot_command.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from . import base
|
||||
from . import fields
|
||||
|
||||
|
||||
class BotCommand(base.TelegramObject):
|
||||
"""
|
||||
This object represents a bot command.
|
||||
|
||||
https://core.telegram.org/bots/api#botcommand
|
||||
"""
|
||||
command: base.String = fields.Field()
|
||||
description: base.String = fields.Field()
|
||||
|
||||
def __init__(self, command: base.String, description: base.String):
|
||||
super(BotCommand, self).__init__(command=command, description=description)
|
||||
13
aiogram/types/dice.py
Normal file
13
aiogram/types/dice.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from . import base, fields
|
||||
|
||||
|
||||
class Dice(base.TelegramObject):
|
||||
"""
|
||||
This object represents a dice with random value from 1 to 6.
|
||||
(Yes, we're aware of the “proper” singular of die.
|
||||
But it's awkward, and we decided to help it change. One dice at a time!)
|
||||
|
||||
https://core.telegram.org/bots/api#dice
|
||||
"""
|
||||
|
||||
value: base.Integer = fields.Field()
|
||||
|
|
@ -10,6 +10,7 @@ from .animation import Animation
|
|||
from .audio import Audio
|
||||
from .chat import Chat, ChatType
|
||||
from .contact import Contact
|
||||
from .dice import Dice
|
||||
from .document import Document
|
||||
from .force_reply import ForceReply
|
||||
from .game import Game
|
||||
|
|
@ -70,6 +71,8 @@ class Message(base.TelegramObject):
|
|||
contact: Contact = fields.Field(base=Contact)
|
||||
location: Location = fields.Field(base=Location)
|
||||
venue: Venue = fields.Field(base=Venue)
|
||||
poll: Poll = fields.Field(base=Poll)
|
||||
dice: Dice = fields.Field(base=Dice)
|
||||
new_chat_members: typing.List[User] = fields.ListField(base=User)
|
||||
left_chat_member: User = fields.Field(base=User)
|
||||
new_chat_title: base.String = fields.Field()
|
||||
|
|
@ -85,7 +88,6 @@ class Message(base.TelegramObject):
|
|||
successful_payment: SuccessfulPayment = fields.Field(base=SuccessfulPayment)
|
||||
connected_website: base.String = fields.Field()
|
||||
passport_data: PassportData = fields.Field(base=PassportData)
|
||||
poll: Poll = fields.Field(base=Poll)
|
||||
reply_markup: InlineKeyboardMarkup = fields.Field(base=InlineKeyboardMarkup)
|
||||
|
||||
@property
|
||||
|
|
@ -117,6 +119,10 @@ class Message(base.TelegramObject):
|
|||
return ContentType.VENUE
|
||||
if self.location:
|
||||
return ContentType.LOCATION
|
||||
if self.poll:
|
||||
return ContentType.POLL
|
||||
if self.dice:
|
||||
return ContentType.DICE
|
||||
if self.new_chat_members:
|
||||
return ContentType.NEW_CHAT_MEMBERS
|
||||
if self.left_chat_member:
|
||||
|
|
@ -143,8 +149,7 @@ class Message(base.TelegramObject):
|
|||
return ContentType.GROUP_CHAT_CREATED
|
||||
if self.passport_data:
|
||||
return ContentType.PASSPORT_DATA
|
||||
if self.poll:
|
||||
return ContentType.POLL
|
||||
|
||||
|
||||
return ContentType.UNKNOWN
|
||||
|
||||
|
|
@ -1685,6 +1690,8 @@ class ContentType(helper.Helper):
|
|||
CONTACT = helper.Item() # contact
|
||||
LOCATION = helper.Item() # location
|
||||
VENUE = helper.Item() # venue
|
||||
POLL = helper.Item() # poll
|
||||
DICE = helper.Item() # dice
|
||||
NEW_CHAT_MEMBERS = helper.Item() # new_chat_member
|
||||
LEFT_CHAT_MEMBER = helper.Item() # left_chat_member
|
||||
INVOICE = helper.Item() # invoice
|
||||
|
|
@ -1698,7 +1705,6 @@ class ContentType(helper.Helper):
|
|||
DELETE_CHAT_PHOTO = helper.Item() # delete_chat_photo
|
||||
GROUP_CHAT_CREATED = helper.Item() # group_chat_created
|
||||
PASSPORT_DATA = helper.Item() # passport_data
|
||||
POLL = helper.Item()
|
||||
|
||||
UNKNOWN = helper.Item() # unknown
|
||||
ANY = helper.Item() # any
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import typing
|
|||
|
||||
from . import base
|
||||
from . import fields
|
||||
from .photo_size import PhotoSize
|
||||
from .sticker import Sticker
|
||||
|
||||
|
||||
|
|
@ -16,3 +17,4 @@ class StickerSet(base.TelegramObject):
|
|||
is_animated: base.Boolean = fields.Field()
|
||||
contains_masks: base.Boolean = fields.Field()
|
||||
stickers: typing.List[Sticker] = fields.ListField(base=Sticker)
|
||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue