mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge branch 'dev-2.x-api-5.0' into dev-2.x
This commit is contained in:
commit
2f64fee5a4
19 changed files with 1548 additions and 540 deletions
|
|
@ -44,4 +44,4 @@ __all__ = (
|
|||
)
|
||||
|
||||
__version__ = '2.10'
|
||||
__api_version__ = '4.9'
|
||||
__api_version__ = '5.0'
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class Methods(Helper):
|
|||
"""
|
||||
Helper for Telegram API Methods listed on https://core.telegram.org/bots/api
|
||||
|
||||
List is updated to Bot API 4.9
|
||||
List is updated to Bot API 5.0
|
||||
"""
|
||||
mode = HelperMode.lowerCamelCase
|
||||
|
||||
|
|
@ -165,8 +165,11 @@ class Methods(Helper):
|
|||
|
||||
# Available methods
|
||||
GET_ME = Item() # getMe
|
||||
LOG_OUT = Item() # logOut
|
||||
CLOSE = Item() # close
|
||||
SEND_MESSAGE = Item() # sendMessage
|
||||
FORWARD_MESSAGE = Item() # forwardMessage
|
||||
COPY_MESSAGE = Item() # copyMessage
|
||||
SEND_PHOTO = Item() # sendPhoto
|
||||
SEND_AUDIO = Item() # sendAudio
|
||||
SEND_DOCUMENT = Item() # sendDocument
|
||||
|
|
@ -198,6 +201,7 @@ class Methods(Helper):
|
|||
SET_CHAT_DESCRIPTION = Item() # setChatDescription
|
||||
PIN_CHAT_MESSAGE = Item() # pinChatMessage
|
||||
UNPIN_CHAT_MESSAGE = Item() # unpinChatMessage
|
||||
UNPIN_ALL_CHAT_MESSAGES = Item() # unpinAllChatMessages
|
||||
LEAVE_CHAT = Item() # leaveChat
|
||||
GET_CHAT = Item() # getChat
|
||||
GET_CHAT_ADMINISTRATORS = Item() # getChatAdministrators
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ from . import api
|
|||
from ..types import ParseMode, base
|
||||
from ..utils import json
|
||||
from ..utils.auth_widget import check_integrity
|
||||
from ..utils.deprecated import deprecated
|
||||
|
||||
|
||||
class BaseBot:
|
||||
|
|
@ -173,6 +174,8 @@ class BaseBot:
|
|||
finally:
|
||||
self._ctx_token.reset(token)
|
||||
|
||||
@deprecated("This method's behavior will be changed in aiogram v3.0. "
|
||||
"More info: https://core.telegram.org/bots/api#close")
|
||||
async def close(self):
|
||||
"""
|
||||
Close all client sessions
|
||||
|
|
|
|||
1000
aiogram/bot/bot.py
1000
aiogram/bot/bot.py
File diff suppressed because it is too large
Load diff
|
|
@ -15,6 +15,7 @@ class Audio(base.TelegramObject, mixins.Downloadable):
|
|||
duration: base.Integer = fields.Field()
|
||||
performer: base.String = fields.Field()
|
||||
title: base.String = fields.Field()
|
||||
file_name: base.String = fields.Field()
|
||||
mime_type: base.String = fields.Field()
|
||||
file_size: base.Integer = fields.Field()
|
||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ import asyncio
|
|||
import datetime
|
||||
import typing
|
||||
|
||||
from ..utils import helper, markdown
|
||||
from . import base, fields
|
||||
from .chat_location import ChatLocation
|
||||
from .chat_member import ChatMember
|
||||
from .chat_permissions import ChatPermissions
|
||||
from .chat_photo import ChatPhoto
|
||||
from .input_file import InputFile
|
||||
from ..utils import helper, markdown
|
||||
from ..utils.deprecated import deprecated
|
||||
|
||||
|
||||
|
|
@ -27,6 +28,7 @@ class Chat(base.TelegramObject):
|
|||
last_name: base.String = fields.Field()
|
||||
all_members_are_administrators: base.Boolean = fields.Field()
|
||||
photo: ChatPhoto = fields.Field(base=ChatPhoto)
|
||||
bio: typing.Optional[base.String] = fields.Field()
|
||||
description: base.String = fields.Field()
|
||||
invite_link: base.String = fields.Field()
|
||||
pinned_message: 'Message' = fields.Field(base='Message')
|
||||
|
|
@ -34,6 +36,8 @@ class Chat(base.TelegramObject):
|
|||
slow_mode_delay: base.Integer = fields.Field()
|
||||
sticker_set_name: base.String = fields.Field()
|
||||
can_set_sticker_set: base.Boolean = fields.Field()
|
||||
linked_chat_id: typing.Optional[base.Integer] = fields.Field()
|
||||
location: typing.Optional[ChatLocation] = fields.Field()
|
||||
|
||||
def __hash__(self):
|
||||
return self.id
|
||||
|
|
@ -182,7 +186,8 @@ class Chat(base.TelegramObject):
|
|||
return await self.bot.set_chat_description(self.id, description)
|
||||
|
||||
async def kick(self, user_id: base.Integer,
|
||||
until_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None) -> base.Boolean:
|
||||
until_date: typing.Union[
|
||||
base.Integer, datetime.datetime, datetime.timedelta, None] = None) -> base.Boolean:
|
||||
"""
|
||||
Use this method to kick a user from a group, a supergroup or a channel.
|
||||
In the case of supergroups and channels, the user will not be able to return to the group
|
||||
|
|
@ -205,21 +210,35 @@ class Chat(base.TelegramObject):
|
|||
"""
|
||||
return await self.bot.kick_chat_member(self.id, user_id=user_id, until_date=until_date)
|
||||
|
||||
async def unban(self, user_id: base.Integer) -> base.Boolean:
|
||||
async def unban(self,
|
||||
user_id: base.Integer,
|
||||
only_if_banned: typing.Optional[base.Boolean] = None,
|
||||
) -> base.Boolean:
|
||||
"""
|
||||
Use this method to unban a previously kicked user in a supergroup or channel. `
|
||||
The user will not return to the group or channel automatically, but will be able to join via link, etc.
|
||||
|
||||
The bot must be an administrator for this to work.
|
||||
Use this method to unban a previously kicked user in a supergroup or channel.
|
||||
The user will not return to the group or channel automatically, but will be
|
||||
able to join via link, etc. The bot must be an administrator for this to
|
||||
work. By default, this method guarantees that after the call the user is not
|
||||
a member of the chat, but will be able to join it. So if the user is a member
|
||||
of the chat they will also be removed from the chat. If you don't want this,
|
||||
use the parameter only_if_banned. Returns True on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unbanchatmember
|
||||
|
||||
:param user_id: Unique identifier of the target user
|
||||
:type user_id: :obj:`base.Integer`
|
||||
|
||||
:param only_if_banned: Do nothing if the user is not banned
|
||||
:type only_if_banned: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`base.Boolean`
|
||||
"""
|
||||
return await self.bot.unban_chat_member(self.id, user_id=user_id)
|
||||
return await self.bot.unban_chat_member(
|
||||
chat_id=self.id,
|
||||
user_id=user_id,
|
||||
only_if_banned=only_if_banned,
|
||||
)
|
||||
|
||||
async def restrict(self, user_id: base.Integer,
|
||||
permissions: typing.Optional[ChatPermissions] = None,
|
||||
|
|
@ -338,36 +357,73 @@ class Chat(base.TelegramObject):
|
|||
:param custom_title: New custom title for the administrator; 0-16 characters, emoji are not allowed
|
||||
:return: True on success.
|
||||
"""
|
||||
return await self.bot.set_chat_administrator_custom_title(chat_id=self.id, user_id=user_id, custom_title=custom_title)
|
||||
return await self.bot.set_chat_administrator_custom_title(chat_id=self.id, user_id=user_id,
|
||||
custom_title=custom_title)
|
||||
|
||||
async def pin_message(self, message_id: base.Integer, disable_notification: base.Boolean = False) -> base.Boolean:
|
||||
async def pin_message(self,
|
||||
message_id: base.Integer,
|
||||
disable_notification: typing.Optional[base.Boolean] = False,
|
||||
) -> base.Boolean:
|
||||
"""
|
||||
Use this method to pin a message in a supergroup.
|
||||
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
||||
Use this method to add a message to the list of pinned messages in a chat.
|
||||
If the chat is not a private chat, the bot must be an administrator in the
|
||||
chat for this to work and must have the 'can_pin_messages' admin right in a
|
||||
supergroup or 'can_edit_messages' admin right in a channel. Returns True on
|
||||
success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#pinchatmessage
|
||||
|
||||
:param message_id: Identifier of a message to pin
|
||||
:type message_id: :obj:`base.Integer`
|
||||
:param disable_notification: Pass True, if it is not necessary to send a notification to
|
||||
all group members about the new pinned message
|
||||
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
|
||||
:return: Returns True on success.
|
||||
|
||||
:param disable_notification: Pass True, if it is not necessary to send a
|
||||
notification to all group members about the new pinned message
|
||||
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:return: Returns True on success
|
||||
:rtype: :obj:`base.Boolean`
|
||||
"""
|
||||
return await self.bot.pin_chat_message(self.id, message_id, disable_notification)
|
||||
|
||||
async def unpin_message(self) -> base.Boolean:
|
||||
async def unpin_message(self,
|
||||
message_id: typing.Optional[base.Integer] = None,
|
||||
) -> base.Boolean:
|
||||
"""
|
||||
Use this method to unpin a message in a supergroup chat.
|
||||
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
||||
Use this method to remove a message from the list of pinned messages in a
|
||||
chat. If the chat is not a private chat, the bot must be an administrator in
|
||||
the chat for this to work and must have the 'can_pin_messages' admin right in
|
||||
a supergroup or 'can_edit_messages' admin right in a channel. Returns True on
|
||||
success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinchatmessage
|
||||
|
||||
:return: Returns True on success.
|
||||
:param message_id: Identifier of a message to unpin. If not specified, the
|
||||
most recent pinned message (by sending date) will be unpinned.
|
||||
:type message_id: :obj:`typing.Optional[base.Integer]`
|
||||
|
||||
:return: Returns True on success
|
||||
:rtype: :obj:`base.Boolean`
|
||||
"""
|
||||
return await self.bot.unpin_chat_message(self.id)
|
||||
return await self.bot.unpin_chat_message(
|
||||
chat_id=self.id,
|
||||
message_id=message_id,
|
||||
)
|
||||
|
||||
async def unpin_all_messages(self):
|
||||
"""
|
||||
Use this method to clear the list of pinned messages in a chat. If the chat
|
||||
is not a private chat, the bot must be an administrator in the chat for this
|
||||
to work and must have the 'can_pin_messages' admin right in a supergroup or
|
||||
'can_edit_messages' admin right in a channel. Returns True on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinallchatmessages
|
||||
|
||||
:return: Returns True on success
|
||||
:rtype: :obj:`base.Boolean`
|
||||
"""
|
||||
return await self.bot.unpin_all_chat_messages(
|
||||
chat_id=self.id,
|
||||
)
|
||||
|
||||
async def leave(self) -> base.Boolean:
|
||||
"""
|
||||
|
|
|
|||
16
aiogram/types/chat_location.py
Normal file
16
aiogram/types/chat_location.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
from . import base
|
||||
from . import fields
|
||||
from .location import Location
|
||||
|
||||
|
||||
class ChatLocation(base.TelegramObject):
|
||||
"""
|
||||
Represents a location to which a chat is connected.
|
||||
|
||||
https://core.telegram.org/bots/api#chatlocation
|
||||
"""
|
||||
location: Location = fields.Field()
|
||||
address: base.String = fields.Field()
|
||||
|
||||
def __init__(self, location: Location, address: base.String):
|
||||
super().__init__(location=location, address=address)
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
import datetime
|
||||
import warnings
|
||||
from typing import Optional
|
||||
|
||||
from . import base
|
||||
from . import fields
|
||||
|
|
@ -17,6 +15,7 @@ class ChatMember(base.TelegramObject):
|
|||
user: User = fields.Field(base=User)
|
||||
status: base.String = fields.Field()
|
||||
custom_title: base.String = fields.Field()
|
||||
is_anonymous: base.Boolean = fields.Field()
|
||||
until_date: datetime.datetime = fields.DateTimeField()
|
||||
can_be_edited: base.Boolean = fields.Field()
|
||||
can_change_info: base.Boolean = fields.Field()
|
||||
|
|
|
|||
|
|
@ -17,5 +17,5 @@ class DiceEmoji:
|
|||
DICE = '🎲'
|
||||
DART = '🎯'
|
||||
BASKETBALL = '🏀'
|
||||
SOCCER = '⚽️'
|
||||
FOOTBALL = '⚽'
|
||||
SLOT_MACHINE = '🎰'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import typing
|
||||
|
||||
from . import base
|
||||
from . import base, MessageEntity
|
||||
from . import fields
|
||||
from .inline_keyboard import InlineKeyboardMarkup
|
||||
from .input_message_content import InputMessageContent
|
||||
|
|
@ -83,23 +83,29 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
photo_url: base.String,
|
||||
thumb_url: base.String,
|
||||
photo_width: typing.Optional[base.Integer] = None,
|
||||
photo_height: typing.Optional[base.Integer] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
description: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultPhoto, self).__init__(id=id, photo_url=photo_url, thumb_url=thumb_url,
|
||||
photo_width=photo_width, photo_height=photo_height, title=title,
|
||||
description=description, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
photo_url: base.String,
|
||||
thumb_url: base.String,
|
||||
photo_width: typing.Optional[base.Integer] = None,
|
||||
photo_height: typing.Optional[base.Integer] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
description: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, photo_url=photo_url, thumb_url=thumb_url,
|
||||
photo_width=photo_width, photo_height=photo_height, title=title,
|
||||
description=description, caption=caption,
|
||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
reply_markup=reply_markup, input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultGif(InlineQueryResult):
|
||||
|
|
@ -123,23 +129,29 @@ class InlineQueryResultGif(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
gif_url: base.String,
|
||||
gif_width: typing.Optional[base.Integer] = None,
|
||||
gif_height: typing.Optional[base.Integer] = None,
|
||||
gif_duration: typing.Optional[base.Integer] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultGif, self).__init__(id=id, gif_url=gif_url, gif_width=gif_width,
|
||||
gif_height=gif_height, gif_duration=gif_duration,
|
||||
thumb_url=thumb_url, title=title, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
gif_url: base.String,
|
||||
gif_width: typing.Optional[base.Integer] = None,
|
||||
gif_height: typing.Optional[base.Integer] = None,
|
||||
gif_duration: typing.Optional[base.Integer] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, gif_url=gif_url, gif_width=gif_width, gif_height=gif_height,
|
||||
gif_duration=gif_duration, thumb_url=thumb_url, title=title,
|
||||
caption=caption, parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
caption_entities=caption_entities,
|
||||
input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
||||
|
|
@ -163,23 +175,30 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
mpeg4_url: base.String,
|
||||
thumb_url: base.String,
|
||||
mpeg4_width: typing.Optional[base.Integer] = None,
|
||||
mpeg4_height: typing.Optional[base.Integer] = None,
|
||||
mpeg4_duration: typing.Optional[base.Integer] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultMpeg4Gif, self).__init__(id=id, mpeg4_url=mpeg4_url, mpeg4_width=mpeg4_width,
|
||||
mpeg4_height=mpeg4_height, mpeg4_duration=mpeg4_duration,
|
||||
thumb_url=thumb_url, title=title, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
mpeg4_url: base.String,
|
||||
thumb_url: base.String,
|
||||
mpeg4_width: typing.Optional[base.Integer] = None,
|
||||
mpeg4_height: typing.Optional[base.Integer] = None,
|
||||
mpeg4_duration: typing.Optional[base.Integer] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, mpeg4_url=mpeg4_url, mpeg4_width=mpeg4_width,
|
||||
mpeg4_height=mpeg4_height, mpeg4_duration=mpeg4_duration,
|
||||
thumb_url=thumb_url, title=title, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
caption_entities=caption_entities,
|
||||
input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultVideo(InlineQueryResult):
|
||||
|
|
@ -207,26 +226,32 @@ class InlineQueryResultVideo(InlineQueryResult):
|
|||
description: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
video_url: base.String,
|
||||
mime_type: base.String,
|
||||
thumb_url: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
video_width: typing.Optional[base.Integer] = None,
|
||||
video_height: typing.Optional[base.Integer] = None,
|
||||
video_duration: typing.Optional[base.Integer] = None,
|
||||
description: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultVideo, self).__init__(id=id, video_url=video_url, mime_type=mime_type,
|
||||
thumb_url=thumb_url, title=title, caption=caption,
|
||||
video_width=video_width, video_height=video_height,
|
||||
video_duration=video_duration, description=description,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
video_url: base.String,
|
||||
mime_type: base.String,
|
||||
thumb_url: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
video_width: typing.Optional[base.Integer] = None,
|
||||
video_height: typing.Optional[base.Integer] = None,
|
||||
video_duration: typing.Optional[base.Integer] = None,
|
||||
description: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, video_url=video_url, mime_type=mime_type, thumb_url=thumb_url,
|
||||
title=title, caption=caption, video_width=video_width,
|
||||
video_height=video_height, video_duration=video_duration,
|
||||
description=description, parse_mode=parse_mode,
|
||||
reply_markup=reply_markup, caption_entities=caption_entities,
|
||||
input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultAudio(InlineQueryResult):
|
||||
|
|
@ -248,21 +273,27 @@ class InlineQueryResultAudio(InlineQueryResult):
|
|||
audio_duration: base.Integer = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
audio_url: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
performer: typing.Optional[base.String] = None,
|
||||
audio_duration: typing.Optional[base.Integer] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultAudio, self).__init__(id=id, audio_url=audio_url, title=title,
|
||||
caption=caption, parse_mode=parse_mode,
|
||||
performer=performer, audio_duration=audio_duration,
|
||||
reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
audio_url: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
performer: typing.Optional[base.String] = None,
|
||||
audio_duration: typing.Optional[base.Integer] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, audio_url=audio_url, title=title,
|
||||
caption=caption, parse_mode=parse_mode,
|
||||
performer=performer, audio_duration=audio_duration,
|
||||
reply_markup=reply_markup, caption_entities=caption_entities,
|
||||
input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultVoice(InlineQueryResult):
|
||||
|
|
@ -285,19 +316,25 @@ class InlineQueryResultVoice(InlineQueryResult):
|
|||
voice_duration: base.Integer = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
voice_url: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
voice_duration: typing.Optional[base.Integer] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultVoice, self).__init__(id=id, voice_url=voice_url, title=title,
|
||||
caption=caption, voice_duration=voice_duration,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
voice_url: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
voice_duration: typing.Optional[base.Integer] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, voice_url=voice_url, title=title, caption=caption,
|
||||
voice_duration=voice_duration, parse_mode=parse_mode,
|
||||
reply_markup=reply_markup, caption_entities=caption_entities,
|
||||
input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultDocument(InlineQueryResult):
|
||||
|
|
@ -323,25 +360,31 @@ class InlineQueryResultDocument(InlineQueryResult):
|
|||
thumb_width: base.Integer = fields.Field()
|
||||
thumb_height: base.Integer = fields.Field()
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
document_url: typing.Optional[base.String] = None,
|
||||
mime_type: typing.Optional[base.String] = None,
|
||||
description: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
thumb_width: typing.Optional[base.Integer] = None,
|
||||
thumb_height: typing.Optional[base.Integer] = None):
|
||||
super(InlineQueryResultDocument, self).__init__(id=id, title=title, caption=caption,
|
||||
document_url=document_url, mime_type=mime_type,
|
||||
description=description, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content,
|
||||
thumb_url=thumb_url, thumb_width=thumb_width,
|
||||
thumb_height=thumb_height, parse_mode=parse_mode)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
document_url: typing.Optional[base.String] = None,
|
||||
mime_type: typing.Optional[base.String] = None,
|
||||
description: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
thumb_width: typing.Optional[base.Integer] = None,
|
||||
thumb_height: typing.Optional[base.Integer] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, title=title, caption=caption, parse_mode=parse_mode,
|
||||
caption_entities=caption_entities, document_url=document_url,
|
||||
mime_type=mime_type, description=description, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content,
|
||||
thumb_url=thumb_url, thumb_width=thumb_width,
|
||||
thumb_height=thumb_height,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultLocation(InlineQueryResult):
|
||||
|
|
@ -352,16 +395,16 @@ class InlineQueryResultLocation(InlineQueryResult):
|
|||
Alternatively, you can use input_message_content to send a message with the specified content
|
||||
instead of the location.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016.
|
||||
Older clients will ignore them.
|
||||
|
||||
https://core.telegram.org/bots/api#inlinequeryresultlocation
|
||||
"""
|
||||
type: base.String = fields.Field(alias='type', default='location')
|
||||
latitude: base.Float = fields.Field()
|
||||
longitude: base.Float = fields.Field()
|
||||
title: base.String = fields.Field()
|
||||
horizontal_accuracy: typing.Optional[base.Float] = fields.Field()
|
||||
live_period: base.Integer = fields.Field()
|
||||
heading: typing.Optional[base.Integer] = fields.Field()
|
||||
proximity_alert_radius: typing.Optional[base.Integer] = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
thumb_url: base.String = fields.Field()
|
||||
thumb_width: base.Integer = fields.Field()
|
||||
|
|
@ -372,18 +415,31 @@ class InlineQueryResultLocation(InlineQueryResult):
|
|||
latitude: base.Float,
|
||||
longitude: base.Float,
|
||||
title: base.String,
|
||||
horizontal_accuracy: typing.Optional[base.Float] = None,
|
||||
live_period: typing.Optional[base.Integer] = None,
|
||||
heading: typing.Optional[base.Integer] = None,
|
||||
proximity_alert_radius: typing.Optional[base.Integer] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
thumb_width: typing.Optional[base.Integer] = None,
|
||||
thumb_height: typing.Optional[base.Integer] = None):
|
||||
super(InlineQueryResultLocation, self).__init__(id=id, latitude=latitude, longitude=longitude,
|
||||
title=title, live_period=live_period,
|
||||
reply_markup=reply_markup,
|
||||
input_message_content=input_message_content,
|
||||
thumb_url=thumb_url, thumb_width=thumb_width,
|
||||
thumb_height=thumb_height)
|
||||
thumb_height: typing.Optional[base.Integer] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id,
|
||||
latitude=latitude,
|
||||
longitude=longitude,
|
||||
title=title,
|
||||
horizontal_accuracy=horizontal_accuracy,
|
||||
live_period=live_period,
|
||||
heading=heading,
|
||||
proximity_alert_radius=proximity_alert_radius,
|
||||
reply_markup=reply_markup,
|
||||
input_message_content=input_message_content,
|
||||
thumb_url=thumb_url,
|
||||
thumb_width=thumb_width,
|
||||
thumb_height=thumb_height
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultVenue(InlineQueryResult):
|
||||
|
|
@ -404,31 +460,40 @@ class InlineQueryResultVenue(InlineQueryResult):
|
|||
title: base.String = fields.Field()
|
||||
address: base.String = fields.Field()
|
||||
foursquare_id: base.String = fields.Field()
|
||||
foursquare_type: base.String = fields.Field()
|
||||
google_place_id: base.String = fields.Field()
|
||||
google_place_type: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
thumb_url: base.String = fields.Field()
|
||||
thumb_width: base.Integer = fields.Field()
|
||||
thumb_height: base.Integer = fields.Field()
|
||||
foursquare_type: base.String = fields.Field()
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
latitude: base.Float,
|
||||
longitude: base.Float,
|
||||
title: base.String,
|
||||
address: base.String,
|
||||
foursquare_id: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
thumb_width: typing.Optional[base.Integer] = None,
|
||||
thumb_height: typing.Optional[base.Integer] = None,
|
||||
foursquare_type: typing.Optional[base.String] = None):
|
||||
super(InlineQueryResultVenue, self).__init__(id=id, latitude=latitude, longitude=longitude,
|
||||
title=title, address=address, foursquare_id=foursquare_id,
|
||||
reply_markup=reply_markup,
|
||||
input_message_content=input_message_content, thumb_url=thumb_url,
|
||||
thumb_width=thumb_width, thumb_height=thumb_height,
|
||||
foursquare_type=foursquare_type)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
latitude: base.Float,
|
||||
longitude: base.Float,
|
||||
title: base.String,
|
||||
address: base.String,
|
||||
foursquare_id: typing.Optional[base.String] = None,
|
||||
foursquare_type: typing.Optional[base.String] = None,
|
||||
google_place_id: typing.Optional[base.String] = None,
|
||||
google_place_type: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
thumb_width: typing.Optional[base.Integer] = None,
|
||||
thumb_height: typing.Optional[base.Integer] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, latitude=latitude, longitude=longitude, title=title,
|
||||
address=address, foursquare_id=foursquare_id,
|
||||
foursquare_type=foursquare_type, google_place_id=google_place_id,
|
||||
google_place_type=google_place_type, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content, thumb_url=thumb_url,
|
||||
thumb_width=thumb_width, thumb_height=thumb_height,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultContact(InlineQueryResult):
|
||||
|
|
@ -510,19 +575,24 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
photo_file_id: base.String,
|
||||
title: typing.Optional[base.String] = None,
|
||||
description: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultCachedPhoto, self).__init__(id=id, photo_file_id=photo_file_id, title=title,
|
||||
description=description, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
photo_file_id: base.String,
|
||||
title: typing.Optional[base.String] = None,
|
||||
description: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, photo_file_id=photo_file_id, title=title, description=description,
|
||||
caption=caption, parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
reply_markup=reply_markup, input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultCachedGif(InlineQueryResult):
|
||||
|
|
@ -541,18 +611,23 @@ class InlineQueryResultCachedGif(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
gif_file_id: base.String,
|
||||
title: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultCachedGif, self).__init__(id=id, gif_file_id=gif_file_id,
|
||||
title=title, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
gif_file_id: base.String,
|
||||
title: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, gif_file_id=gif_file_id, title=title, caption=caption,
|
||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
reply_markup=reply_markup, input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
||||
|
|
@ -571,18 +646,23 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
mpeg4_file_id: base.String,
|
||||
title: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultCachedMpeg4Gif, self).__init__(id=id, mpeg4_file_id=mpeg4_file_id,
|
||||
title=title, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
mpeg4_file_id: base.String,
|
||||
title: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, mpeg4_file_id=mpeg4_file_id, title=title, caption=caption,
|
||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
reply_markup=reply_markup, input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultCachedSticker(InlineQueryResult):
|
||||
|
|
@ -631,20 +711,25 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
title: base.String,
|
||||
document_file_id: base.String,
|
||||
description: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultCachedDocument, self).__init__(id=id, title=title,
|
||||
document_file_id=document_file_id,
|
||||
description=description, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
title: base.String,
|
||||
document_file_id: base.String,
|
||||
description: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, title=title, document_file_id=document_file_id,
|
||||
description=description, caption=caption, parse_mode=parse_mode,
|
||||
caption_entities=caption_entities, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultCachedVideo(InlineQueryResult):
|
||||
|
|
@ -664,19 +749,24 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
video_file_id: base.String,
|
||||
title: base.String,
|
||||
description: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultCachedVideo, self).__init__(id=id, video_file_id=video_file_id, title=title,
|
||||
description=description, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
video_file_id: base.String,
|
||||
title: base.String,
|
||||
description: typing.Optional[base.String] = None,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, video_file_id=video_file_id, title=title, description=description,
|
||||
caption=caption, parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
reply_markup=reply_markup, input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultCachedVoice(InlineQueryResult):
|
||||
|
|
@ -697,18 +787,23 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
voice_file_id: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultCachedVoice, self).__init__(id=id, voice_file_id=voice_file_id,
|
||||
title=title, caption=caption,
|
||||
parse_mode=parse_mode, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
voice_file_id: base.String,
|
||||
title: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, voice_file_id=voice_file_id, title=title, caption=caption,
|
||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
reply_markup=reply_markup, input_message_content=input_message_content,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultCachedAudio(InlineQueryResult):
|
||||
|
|
@ -729,14 +824,19 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
|
|||
caption: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
audio_file_id: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None):
|
||||
super(InlineQueryResultCachedAudio, self).__init__(id=id, audio_file_id=audio_file_id,
|
||||
caption=caption, parse_mode=parse_mode,
|
||||
reply_markup=reply_markup,
|
||||
input_message_content=input_message_content)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
audio_file_id: base.String,
|
||||
caption: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, audio_file_id=audio_file_id, caption=caption,
|
||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
reply_markup=reply_markup, input_message_content=input_message_content,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import typing
|
|||
from . import base
|
||||
from . import fields
|
||||
from .input_file import InputFile
|
||||
from .message_entity import MessageEntity
|
||||
|
||||
ATTACHMENT_PREFIX = 'attach://'
|
||||
|
||||
|
|
@ -106,28 +107,48 @@ class InputMediaAnimation(InputMedia):
|
|||
height: base.Integer = fields.Field()
|
||||
duration: base.Integer = fields.Field()
|
||||
|
||||
def __init__(self, media: base.InputFile,
|
||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None,
|
||||
width: base.Integer = None, height: base.Integer = None, duration: base.Integer = None,
|
||||
parse_mode: base.String = None, **kwargs):
|
||||
super(InputMediaAnimation, self).__init__(type='animation', media=media, thumb=thumb, caption=caption,
|
||||
width=width, height=height, duration=duration,
|
||||
parse_mode=parse_mode, conf=kwargs)
|
||||
def __init__(
|
||||
self,
|
||||
media: base.InputFile,
|
||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None,
|
||||
width: base.Integer = None,
|
||||
height: base.Integer = None,
|
||||
duration: base.Integer = None,
|
||||
parse_mode: base.String = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(
|
||||
type='animation', media=media, thumb=thumb, caption=caption, width=width,
|
||||
height=height, duration=duration, parse_mode=parse_mode,
|
||||
caption_entities=caption_entities, conf=kwargs,
|
||||
)
|
||||
|
||||
|
||||
class InputMediaDocument(InputMedia):
|
||||
"""
|
||||
Represents a photo to be sent.
|
||||
Represents a general file to be sent.
|
||||
|
||||
https://core.telegram.org/bots/api#inputmediadocument
|
||||
"""
|
||||
|
||||
def __init__(self, media: base.InputFile, thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None, parse_mode: base.String = None, **kwargs):
|
||||
super(InputMediaDocument, self).__init__(type='document', media=media, thumb=thumb,
|
||||
caption=caption, parse_mode=parse_mode,
|
||||
conf=kwargs)
|
||||
def __init__(
|
||||
self,
|
||||
media: base.InputFile,
|
||||
thumb: typing.Union[base.InputFile, base.String, None] = None,
|
||||
caption: base.String = None,
|
||||
parse_mode: base.String = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
disable_content_type_detection: typing.Optional[base.Boolean] = None,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(
|
||||
type='document', media=media, thumb=thumb, caption=caption,
|
||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
disable_content_type_detection=disable_content_type_detection,
|
||||
conf=kwargs,
|
||||
)
|
||||
|
||||
|
||||
class InputMediaAudio(InputMedia):
|
||||
|
|
@ -141,17 +162,23 @@ class InputMediaAudio(InputMedia):
|
|||
performer: base.String = fields.Field()
|
||||
title: base.String = fields.Field()
|
||||
|
||||
def __init__(self, media: base.InputFile,
|
||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None,
|
||||
duration: base.Integer = None,
|
||||
performer: base.String = None,
|
||||
title: base.String = None,
|
||||
parse_mode: base.String = None, **kwargs):
|
||||
super(InputMediaAudio, self).__init__(type='audio', media=media, thumb=thumb,
|
||||
caption=caption, duration=duration,
|
||||
performer=performer, title=title,
|
||||
parse_mode=parse_mode, conf=kwargs)
|
||||
def __init__(
|
||||
self,
|
||||
media: base.InputFile,
|
||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None,
|
||||
duration: base.Integer = None,
|
||||
performer: base.String = None,
|
||||
title: base.String = None,
|
||||
parse_mode: base.String = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(
|
||||
type='audio', media=media, thumb=thumb, caption=caption,
|
||||
duration=duration, performer=performer, title=title,
|
||||
parse_mode=parse_mode, caption_entities=caption_entities, conf=kwargs,
|
||||
)
|
||||
|
||||
|
||||
class InputMediaPhoto(InputMedia):
|
||||
|
|
@ -161,11 +188,18 @@ class InputMediaPhoto(InputMedia):
|
|||
https://core.telegram.org/bots/api#inputmediaphoto
|
||||
"""
|
||||
|
||||
def __init__(self, media: base.InputFile, thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None, parse_mode: base.String = None, **kwargs):
|
||||
super(InputMediaPhoto, self).__init__(type='photo', media=media, thumb=thumb,
|
||||
caption=caption, parse_mode=parse_mode,
|
||||
conf=kwargs)
|
||||
def __init__(
|
||||
self,
|
||||
media: base.InputFile,
|
||||
caption: base.String = None,
|
||||
parse_mode: base.String = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(
|
||||
type='photo', media=media, caption=caption, parse_mode=parse_mode,
|
||||
caption_entities=caption_entities, conf=kwargs,
|
||||
)
|
||||
|
||||
|
||||
class InputMediaVideo(InputMedia):
|
||||
|
|
@ -179,16 +213,25 @@ class InputMediaVideo(InputMedia):
|
|||
duration: base.Integer = fields.Field()
|
||||
supports_streaming: base.Boolean = fields.Field()
|
||||
|
||||
def __init__(self, media: base.InputFile,
|
||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None,
|
||||
width: base.Integer = None, height: base.Integer = None, duration: base.Integer = None,
|
||||
parse_mode: base.String = None,
|
||||
supports_streaming: base.Boolean = None, **kwargs):
|
||||
super(InputMediaVideo, self).__init__(type='video', media=media, thumb=thumb, caption=caption,
|
||||
width=width, height=height, duration=duration,
|
||||
parse_mode=parse_mode,
|
||||
supports_streaming=supports_streaming, conf=kwargs)
|
||||
def __init__(
|
||||
self,
|
||||
media: base.InputFile,
|
||||
thumb: typing.Union[base.InputFile, base.String] = None,
|
||||
caption: base.String = None,
|
||||
width: base.Integer = None,
|
||||
height: base.Integer = None,
|
||||
duration: base.Integer = None,
|
||||
parse_mode: base.String = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
supports_streaming: base.Boolean = None,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__(
|
||||
type='video', media=media, thumb=thumb, caption=caption,
|
||||
width=width, height=height, duration=duration,
|
||||
parse_mode=parse_mode, caption_entities=caption_entities,
|
||||
supports_streaming=supports_streaming, conf=kwargs
|
||||
)
|
||||
|
||||
|
||||
class MediaGroup(base.TelegramObject):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import typing
|
||||
|
||||
from . import base
|
||||
from . import base, MessageEntity
|
||||
from . import fields
|
||||
|
||||
|
||||
|
|
@ -40,17 +40,31 @@ class InputLocationMessageContent(InputMessageContent):
|
|||
"""
|
||||
Represents the content of a location message to be sent as the result of an inline query.
|
||||
|
||||
Note: This will only work in Telegram versions released after 9 April, 2016.
|
||||
Older clients will ignore them.
|
||||
|
||||
https://core.telegram.org/bots/api#inputlocationmessagecontent
|
||||
"""
|
||||
latitude: base.Float = fields.Field()
|
||||
longitude: base.Float = fields.Field()
|
||||
horizontal_accuracy: typing.Optional[base.Float] = fields.Field()
|
||||
live_period: typing.Optional[base.Integer] = fields.Field()
|
||||
heading: typing.Optional[base.Integer] = fields.Field()
|
||||
proximity_alert_radius: typing.Optional[base.Integer] = fields.Field()
|
||||
|
||||
def __init__(self, latitude: base.Float,
|
||||
longitude: base.Float):
|
||||
super(InputLocationMessageContent, self).__init__(latitude=latitude, longitude=longitude)
|
||||
def __init__(self,
|
||||
latitude: base.Float,
|
||||
longitude: base.Float,
|
||||
horizontal_accuracy: typing.Optional[base.Float] = None,
|
||||
live_period: typing.Optional[base.Integer] = None,
|
||||
heading: typing.Optional[base.Integer] = None,
|
||||
proximity_alert_radius: typing.Optional[base.Integer] = None,
|
||||
):
|
||||
super().__init__(
|
||||
latitude=latitude,
|
||||
longitude=longitude,
|
||||
horizontal_accuracy=horizontal_accuracy,
|
||||
live_period=live_period,
|
||||
heading=heading,
|
||||
proximity_alert_radius=proximity_alert_radius,
|
||||
)
|
||||
|
||||
|
||||
class InputTextMessageContent(InputMessageContent):
|
||||
|
|
@ -69,14 +83,21 @@ class InputTextMessageContent(InputMessageContent):
|
|||
except RuntimeError:
|
||||
pass
|
||||
|
||||
def __init__(self, message_text: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
disable_web_page_preview: typing.Optional[base.Boolean] = None):
|
||||
def __init__(
|
||||
self,
|
||||
message_text: typing.Optional[base.String] = None,
|
||||
parse_mode: typing.Optional[base.String] = None,
|
||||
caption_entities: typing.Optional[typing.List[MessageEntity]] = None,
|
||||
disable_web_page_preview: typing.Optional[base.Boolean] = None,
|
||||
):
|
||||
if parse_mode is None:
|
||||
parse_mode = self.safe_get_parse_mode()
|
||||
|
||||
super(InputTextMessageContent, self).__init__(message_text=message_text, parse_mode=parse_mode,
|
||||
disable_web_page_preview=disable_web_page_preview)
|
||||
super().__init__(
|
||||
message_text=message_text, parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
disable_web_page_preview=disable_web_page_preview,
|
||||
)
|
||||
|
||||
|
||||
class InputVenueMessageContent(InputMessageContent):
|
||||
|
|
@ -93,11 +114,24 @@ class InputVenueMessageContent(InputMessageContent):
|
|||
title: base.String = fields.Field()
|
||||
address: base.String = fields.Field()
|
||||
foursquare_id: base.String = fields.Field()
|
||||
foursquare_type: base.String = fields.Field()
|
||||
google_place_id: base.String = fields.Field()
|
||||
google_place_type: base.String = fields.Field()
|
||||
|
||||
def __init__(self, latitude: typing.Optional[base.Float] = None,
|
||||
longitude: typing.Optional[base.Float] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
address: typing.Optional[base.String] = None,
|
||||
foursquare_id: typing.Optional[base.String] = None):
|
||||
super(InputVenueMessageContent, self).__init__(latitude=latitude, longitude=longitude, title=title,
|
||||
address=address, foursquare_id=foursquare_id)
|
||||
def __init__(
|
||||
self,
|
||||
latitude: typing.Optional[base.Float] = None,
|
||||
longitude: typing.Optional[base.Float] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
address: typing.Optional[base.String] = None,
|
||||
foursquare_id: typing.Optional[base.String] = None,
|
||||
foursquare_type: typing.Optional[base.String] = None,
|
||||
google_place_id: typing.Optional[base.String] = None,
|
||||
google_place_type: typing.Optional[base.String] = None,
|
||||
):
|
||||
super().__init__(
|
||||
latitude=latitude, longitude=longitude, title=title,
|
||||
address=address, foursquare_id=foursquare_id,
|
||||
foursquare_type=foursquare_type, google_place_id=google_place_id,
|
||||
google_place_type=google_place_type,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import typing
|
||||
|
||||
from . import base
|
||||
from . import fields
|
||||
|
||||
|
|
@ -10,3 +12,7 @@ class Location(base.TelegramObject):
|
|||
"""
|
||||
longitude: base.Float = fields.Field()
|
||||
latitude: base.Float = fields.Field()
|
||||
horizontal_accuracy: typing.Optional[base.Float] = fields.Field()
|
||||
live_period: typing.Optional[base.Integer] = fields.Field()
|
||||
heading: typing.Optional[base.Integer] = fields.Field()
|
||||
proximity_alert_radius: typing.Optional[base.Integer] = fields.Field()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from .message_entity import MessageEntity
|
|||
from .passport_data import PassportData
|
||||
from .photo_size import PhotoSize
|
||||
from .poll import Poll
|
||||
from .proximity_alert_triggered import ProximityAlertTriggered
|
||||
from .reply_keyboard import ReplyKeyboardMarkup, ReplyKeyboardRemove
|
||||
from .sticker import Sticker
|
||||
from .successful_payment import SuccessfulPayment
|
||||
|
|
@ -43,6 +44,7 @@ class Message(base.TelegramObject):
|
|||
|
||||
message_id: base.Integer = fields.Field()
|
||||
from_user: User = fields.Field(alias="from", base=User)
|
||||
sender_chat: Chat = fields.Field(base=Chat)
|
||||
date: datetime.datetime = fields.DateTimeField()
|
||||
chat: Chat = fields.Field(base=Chat)
|
||||
forward_from: User = fields.Field(base=User)
|
||||
|
|
@ -89,6 +91,7 @@ class Message(base.TelegramObject):
|
|||
successful_payment: SuccessfulPayment = fields.Field(base=SuccessfulPayment)
|
||||
connected_website: base.String = fields.Field()
|
||||
passport_data: PassportData = fields.Field(base=PassportData)
|
||||
proximity_alert_triggered: typing.Optional[ProximityAlertTriggered] = fields.Field(base=ProximityAlertTriggered)
|
||||
reply_markup: InlineKeyboardMarkup = fields.Field(base=InlineKeyboardMarkup)
|
||||
|
||||
@property
|
||||
|
|
@ -150,6 +153,8 @@ class Message(base.TelegramObject):
|
|||
return ContentType.GROUP_CHAT_CREATED
|
||||
if self.passport_data:
|
||||
return ContentType.PASSPORT_DATA
|
||||
if self.proximity_alert_triggered:
|
||||
return ContentType.PROXIMITY_ALERT_TRIGGERED
|
||||
|
||||
return ContentType.UNKNOWN
|
||||
|
||||
|
|
@ -513,6 +518,7 @@ class Message(base.TelegramObject):
|
|||
thumb: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
|
||||
caption: typing.Union[base.String, None] = None,
|
||||
parse_mode: typing.Union[base.String, None] = None,
|
||||
disable_content_type_detection: typing.Optional[base.Boolean] = None,
|
||||
disable_notification: typing.Union[base.Boolean, None] = None,
|
||||
reply_markup: typing.Union[
|
||||
InlineKeyboardMarkup,
|
||||
|
|
@ -524,30 +530,45 @@ class Message(base.TelegramObject):
|
|||
reply: base.Boolean = False,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send general files.
|
||||
|
||||
Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send general files. On success, the sent Message is
|
||||
returned. Bots can currently send files of any type of up to 50 MB in size,
|
||||
this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#senddocument
|
||||
|
||||
:param document: File to send.
|
||||
:param document: File to send
|
||||
:type document: :obj:`typing.Union[base.InputFile, base.String]`
|
||||
:param thumb: Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
|
||||
A thumbnail‘s width and height should not exceed 320.
|
||||
:type thumb: :obj:`typing.Union[typing.Union[base.InputFile, base.String], None]`
|
||||
:param caption: Document caption (may also be used when resending documents by file_id), 0-200 characters
|
||||
:type caption: :obj:`typing.Union[base.String, None]`
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption
|
||||
:type parse_mode: :obj:`typing.Union[base.String, None]`
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
||||
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard,
|
||||
custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user
|
||||
|
||||
:param thumb: Thumbnail of the file sent
|
||||
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||
|
||||
:param caption: Document caption (may also be used when resending documents
|
||||
by file_id), 0-1024 characters
|
||||
:type caption: :obj:`typing.Optional[base.String]`
|
||||
|
||||
:param disable_content_type_detection: Disables automatic server-side content
|
||||
type detection for files uploaded using multipart/form-data
|
||||
:type disable_content_type_detection: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in your bot's message.
|
||||
:type parse_mode: :obj:`typing.Optional[base.String]`
|
||||
|
||||
:param disable_notification: Sends the message silently. Users will receive a
|
||||
notification with no sound
|
||||
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:param reply: True if the message is a reply
|
||||
:type reply: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object
|
||||
for an inline keyboard, custom reply keyboard, instructions to remove
|
||||
reply keyboard or to force a reply from the user
|
||||
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
|
||||
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply], None]`
|
||||
:param reply: fill 'reply_to_message_id'
|
||||
:return: On success, the sent Message is returned.
|
||||
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply],
|
||||
None]`
|
||||
|
||||
:return: On success, the sent Message is returned
|
||||
:rtype: :obj:`types.Message`
|
||||
"""
|
||||
return await self.bot.send_document(
|
||||
|
|
@ -556,6 +577,7 @@ class Message(base.TelegramObject):
|
|||
document=document,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
disable_content_type_detection=disable_content_type_detection,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=self.message_id if reply else None,
|
||||
reply_markup=reply_markup,
|
||||
|
|
@ -1299,6 +1321,7 @@ class Message(base.TelegramObject):
|
|||
thumb: typing.Union[typing.Union[base.InputFile, base.String], None] = None,
|
||||
caption: typing.Union[base.String, None] = None,
|
||||
parse_mode: typing.Union[base.String, None] = None,
|
||||
disable_content_type_detection: typing.Optional[base.Boolean] = None,
|
||||
disable_notification: typing.Union[base.Boolean, None] = None,
|
||||
reply_markup: typing.Union[
|
||||
InlineKeyboardMarkup,
|
||||
|
|
@ -1310,30 +1333,45 @@ class Message(base.TelegramObject):
|
|||
reply: base.Boolean = True,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send general files.
|
||||
|
||||
Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
|
||||
Use this method to send general files. On success, the sent Message is
|
||||
returned. Bots can currently send files of any type of up to 50 MB in size,
|
||||
this limit may be changed in the future.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#senddocument
|
||||
|
||||
:param document: File to send.
|
||||
:param document: File to send
|
||||
:type document: :obj:`typing.Union[base.InputFile, base.String]`
|
||||
:param thumb: Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
|
||||
A thumbnail‘s width and height should not exceed 320.
|
||||
:type thumb: :obj:`typing.Union[typing.Union[base.InputFile, base.String], None]`
|
||||
:param caption: Document caption (may also be used when resending documents by file_id), 0-200 characters
|
||||
:type caption: :obj:`typing.Union[base.String, None]`
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption
|
||||
:type parse_mode: :obj:`typing.Union[base.String, None]`
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
||||
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard,
|
||||
custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user
|
||||
|
||||
:param thumb: Thumbnail of the file sent
|
||||
:type thumb: :obj:`typing.Union[base.InputFile, base.String, None]`
|
||||
|
||||
:param caption: Document caption (may also be used when resending documents
|
||||
by file_id), 0-1024 characters
|
||||
:type caption: :obj:`typing.Optional[base.String]`
|
||||
|
||||
:param disable_content_type_detection: Disables automatic server-side content
|
||||
type detection for files uploaded using multipart/form-data
|
||||
:type disable_content_type_detection: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show
|
||||
bold, italic, fixed-width text or inline URLs in your bot's message.
|
||||
:type parse_mode: :obj:`typing.Optional[base.String]`
|
||||
|
||||
:param disable_notification: Sends the message silently. Users will receive a
|
||||
notification with no sound
|
||||
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:param reply: True if the message is a reply
|
||||
:type reply: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object
|
||||
for an inline keyboard, custom reply keyboard, instructions to remove
|
||||
reply keyboard or to force a reply from the user
|
||||
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
|
||||
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply], None]`
|
||||
:param reply: fill 'reply_to_message_id'
|
||||
:return: On success, the sent Message is returned.
|
||||
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply],
|
||||
None]`
|
||||
|
||||
:return: On success, the sent Message is returned
|
||||
:rtype: :obj:`types.Message`
|
||||
"""
|
||||
return await self.bot.send_document(
|
||||
|
|
@ -1342,6 +1380,7 @@ class Message(base.TelegramObject):
|
|||
thumb=thumb,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
disable_content_type_detection=disable_content_type_detection,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=self.message_id if reply else None,
|
||||
reply_markup=reply_markup,
|
||||
|
|
@ -2064,22 +2103,43 @@ class Message(base.TelegramObject):
|
|||
return await self.bot.delete_message(self.chat.id, self.message_id)
|
||||
|
||||
async def pin(
|
||||
self, disable_notification: typing.Union[base.Boolean, None] = None
|
||||
self, disable_notification: typing.Optional[base.Boolean] = None,
|
||||
) -> base.Boolean:
|
||||
"""
|
||||
Use this method to pin a message in a supergroup.
|
||||
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
||||
Use this method to add a message to the list of pinned messages in a chat.
|
||||
If the chat is not a private chat, the bot must be an administrator in the
|
||||
chat for this to work and must have the 'can_pin_messages' admin right in a
|
||||
supergroup or 'can_edit_messages' admin right in a channel. Returns True on
|
||||
success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#pinchatmessage
|
||||
|
||||
:param disable_notification: Pass True, if it is not necessary to send a notification to
|
||||
all group members about the new pinned message
|
||||
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
|
||||
:param disable_notification: Pass True, if it is not necessary to send a
|
||||
notification to all group members about the new pinned message
|
||||
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:return: Returns True on success
|
||||
:rtype: :obj:`base.Boolean`
|
||||
"""
|
||||
return await self.chat.pin_message(self.message_id, disable_notification)
|
||||
|
||||
async def unpin(self) -> base.Boolean:
|
||||
"""
|
||||
Use this method to remove a message from the list of pinned messages in a
|
||||
chat. If the chat is not a private chat, the bot must be an administrator in
|
||||
the chat for this to work and must have the 'can_pin_messages' admin right in
|
||||
a supergroup or 'can_edit_messages' admin right in a channel. Returns True on
|
||||
success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinchatmessage
|
||||
|
||||
:return: Returns True on success
|
||||
:rtype: :obj:`base.Boolean`
|
||||
"""
|
||||
return await self.chat.unpin_message(
|
||||
message_id=self.message_id,
|
||||
)
|
||||
|
||||
async def send_copy(
|
||||
self: Message,
|
||||
chat_id: typing.Union[str, int],
|
||||
|
|
@ -2247,6 +2307,7 @@ 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
|
||||
PROXIMITY_ALERT_TRIGGERED = helper.Item() # proximity_alert_triggered
|
||||
|
||||
UNKNOWN = helper.Item() # unknown
|
||||
ANY = helper.Item() # any
|
||||
|
|
|
|||
15
aiogram/types/proximity_alert_triggered.py
Normal file
15
aiogram/types/proximity_alert_triggered.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from . import base
|
||||
from . import fields
|
||||
from .user import User
|
||||
|
||||
|
||||
class ProximityAlertTriggered(base.TelegramObject):
|
||||
"""
|
||||
This object represents the content of a service message, sent whenever a user in
|
||||
the chat triggers a proximity alert set by another user.
|
||||
|
||||
https://core.telegram.org/bots/api#proximityalerttriggered
|
||||
"""
|
||||
traveler: User = fields.Field()
|
||||
watcher: User = fields.Field()
|
||||
distance: base.Integer = fields.Field()
|
||||
|
|
@ -14,3 +14,5 @@ class Venue(base.TelegramObject):
|
|||
address: base.String = fields.Field()
|
||||
foursquare_id: base.String = fields.Field()
|
||||
foursquare_type: base.String = fields.Field()
|
||||
google_place_id: base.String = fields.Field()
|
||||
google_place_type: base.String = fields.Field()
|
||||
|
|
|
|||
|
|
@ -16,5 +16,6 @@ class Video(base.TelegramObject, mixins.Downloadable):
|
|||
height: base.Integer = fields.Field()
|
||||
duration: base.Integer = fields.Field()
|
||||
thumb: PhotoSize = fields.Field(base=PhotoSize)
|
||||
file_name: base.String = fields.Field()
|
||||
mime_type: base.String = fields.Field()
|
||||
file_size: base.Integer = fields.Field()
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class WebhookInfo(base.TelegramObject):
|
|||
url: base.String = fields.Field()
|
||||
has_custom_certificate: base.Boolean = fields.Field()
|
||||
pending_update_count: base.Integer = fields.Field()
|
||||
ip_address: base.String = fields.Field()
|
||||
last_error_date: base.Integer = fields.Field()
|
||||
last_error_message: base.String = fields.Field()
|
||||
max_connections: base.Integer = fields.Field()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,22 @@ async def test_get_me(bot: Bot, event_loop):
|
|||
assert result == user
|
||||
|
||||
|
||||
async def test_log_out(bot: Bot, event_loop):
|
||||
""" logOut method test """
|
||||
|
||||
async with FakeTelegram(message_data=True, loop=event_loop):
|
||||
result = await bot.log_out()
|
||||
assert result is True
|
||||
|
||||
|
||||
async def test_close_bot(bot: Bot, event_loop):
|
||||
""" close method test """
|
||||
|
||||
async with FakeTelegram(message_data=True, loop=event_loop):
|
||||
result = await bot.close_bot()
|
||||
assert result is True
|
||||
|
||||
|
||||
async def test_send_message(bot: Bot, event_loop):
|
||||
""" sendMessage method test """
|
||||
from .types.dataset import MESSAGE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue