mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Bot API 6.8 (#1276)
* Prepare for Bot API 6.8 * Bump after public release * Bump version, added changelog
This commit is contained in:
parent
bc0932a745
commit
678b3cfe7d
29 changed files with 363 additions and 27 deletions
|
|
@ -1,2 +1,2 @@
|
|||
__version__ = "3.0.0rc2"
|
||||
__api_version__ = "6.7"
|
||||
__api_version__ = "6.8"
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ from ..methods import (
|
|||
UnhideGeneralForumTopic,
|
||||
UnpinAllChatMessages,
|
||||
UnpinAllForumTopicMessages,
|
||||
UnpinAllGeneralForumTopicMessages,
|
||||
UnpinChatMessage,
|
||||
UploadStickerFile,
|
||||
)
|
||||
|
|
@ -4086,3 +4087,23 @@ class Bot:
|
|||
language_code=language_code,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def unpin_all_general_forum_topic_messages(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns :code:`True` on success.
|
||||
"""
|
||||
|
||||
call = UnpinAllGeneralForumTopicMessages(
|
||||
chat_id=chat_id,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class ContentType(str, Enum):
|
|||
DOCUMENT = "document"
|
||||
PHOTO = "photo"
|
||||
STICKER = "sticker"
|
||||
STORY = "story"
|
||||
VIDEO = "video"
|
||||
VIDEO_NOTE = "video_note"
|
||||
VOICE = "voice"
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ from .unban_chat_sender_chat import UnbanChatSenderChat
|
|||
from .unhide_general_forum_topic import UnhideGeneralForumTopic
|
||||
from .unpin_all_chat_messages import UnpinAllChatMessages
|
||||
from .unpin_all_forum_topic_messages import UnpinAllForumTopicMessages
|
||||
from .unpin_all_general_forum_topic_messages import UnpinAllGeneralForumTopicMessages
|
||||
from .unpin_chat_message import UnpinChatMessage
|
||||
from .upload_sticker_file import UploadStickerFile
|
||||
|
||||
|
|
@ -228,6 +229,7 @@ __all__ = (
|
|||
"UnhideGeneralForumTopic",
|
||||
"UnpinAllChatMessages",
|
||||
"UnpinAllForumTopicMessages",
|
||||
"UnpinAllGeneralForumTopicMessages",
|
||||
"UnpinChatMessage",
|
||||
"UploadStickerFile",
|
||||
)
|
||||
|
|
|
|||
30
aiogram/methods/unpin_all_general_forum_topic_messages.py
Normal file
30
aiogram/methods/unpin_all_general_forum_topic_messages.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
from typing import TYPE_CHECKING, Any, Union
|
||||
|
||||
from aiogram.methods import TelegramMethod
|
||||
|
||||
|
||||
class UnpinAllGeneralForumTopicMessages(TelegramMethod[bool]):
|
||||
"""
|
||||
Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
__api_method__ = "unpinAllGeneralForumTopicMessages"
|
||||
|
||||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__, *, chat_id: Union[int, str], **__pydantic_kwargs: Any
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(chat_id=chat_id, **__pydantic_kwargs)
|
||||
|
|
@ -140,6 +140,7 @@ from .shipping_option import ShippingOption
|
|||
from .shipping_query import ShippingQuery
|
||||
from .sticker import Sticker
|
||||
from .sticker_set import StickerSet
|
||||
from .story import Story
|
||||
from .successful_payment import SuccessfulPayment
|
||||
from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat
|
||||
from .update import Update
|
||||
|
|
@ -298,6 +299,7 @@ __all__ = (
|
|||
"ShippingQuery",
|
||||
"Sticker",
|
||||
"StickerSet",
|
||||
"Story",
|
||||
"SuccessfulPayment",
|
||||
"SwitchInlineQueryChosenChat",
|
||||
"TelegramObject",
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ if TYPE_CHECKING:
|
|||
UnbanChatSenderChat,
|
||||
UnpinAllChatMessages,
|
||||
UnpinChatMessage,
|
||||
UnpinAllGeneralForumTopicMessages,
|
||||
)
|
||||
from .chat_location import ChatLocation
|
||||
from .chat_permissions import ChatPermissions
|
||||
|
|
@ -69,6 +70,8 @@ class Chat(TelegramObject):
|
|||
"""*Optional*. If non-empty, the list of all `active chat usernames <https://telegram.org/blog/topics-in-groups-collectible-usernames#collectible-usernames>`_; for private chats, supergroups and channels. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
emoji_status_custom_emoji_id: Optional[str] = None
|
||||
"""*Optional*. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
emoji_status_expiration_date: Optional[datetime.datetime] = None
|
||||
"""*Optional*. Expiration date of the emoji status of the other party in a private chat, if any. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
bio: Optional[str] = None
|
||||
"""*Optional*. Bio of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
||||
has_private_forwards: Optional[bool] = None
|
||||
|
|
@ -123,6 +126,7 @@ class Chat(TelegramObject):
|
|||
photo: Optional[ChatPhoto] = None,
|
||||
active_usernames: Optional[List[str]] = None,
|
||||
emoji_status_custom_emoji_id: Optional[str] = None,
|
||||
emoji_status_expiration_date: Optional[datetime.datetime] = None,
|
||||
bio: Optional[str] = None,
|
||||
has_private_forwards: Optional[bool] = None,
|
||||
has_restricted_voice_and_video_messages: Optional[bool] = None,
|
||||
|
|
@ -158,6 +162,7 @@ class Chat(TelegramObject):
|
|||
photo=photo,
|
||||
active_usernames=active_usernames,
|
||||
emoji_status_custom_emoji_id=emoji_status_custom_emoji_id,
|
||||
emoji_status_expiration_date=emoji_status_expiration_date,
|
||||
bio=bio,
|
||||
has_private_forwards=has_private_forwards,
|
||||
has_restricted_voice_and_video_messages=has_restricted_voice_and_video_messages,
|
||||
|
|
@ -1082,3 +1087,29 @@ class Chat(TelegramObject):
|
|||
photo=photo,
|
||||
**kwargs,
|
||||
).as_(self._bot)
|
||||
|
||||
def unpin_all_general_forum_topic_messages(
|
||||
self,
|
||||
**kwargs: Any,
|
||||
) -> UnpinAllGeneralForumTopicMessages:
|
||||
"""
|
||||
Shortcut for method :class:`aiogram.methods.unpin_all_general_forum_topic_messages.UnpinAllGeneralForumTopicMessages`
|
||||
will automatically fill method attributes:
|
||||
|
||||
- :code:`chat_id`
|
||||
|
||||
Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the *can_pin_messages* administrator right in the supergroup. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
||||
|
||||
:return: instance of method :class:`aiogram.methods.unpin_all_general_forum_topic_messages.UnpinAllGeneralForumTopicMessages`
|
||||
"""
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This method was auto-generated via `butcher`
|
||||
|
||||
from aiogram.methods import UnpinAllGeneralForumTopicMessages
|
||||
|
||||
return UnpinAllGeneralForumTopicMessages(
|
||||
chat_id=self.id,
|
||||
**kwargs,
|
||||
).as_(self._bot)
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ if TYPE_CHECKING:
|
|||
from .reply_keyboard_markup import ReplyKeyboardMarkup
|
||||
from .reply_keyboard_remove import ReplyKeyboardRemove
|
||||
from .sticker import Sticker
|
||||
from .story import Story
|
||||
from .successful_payment import SuccessfulPayment
|
||||
from .user import User
|
||||
from .user_shared import UserShared
|
||||
|
|
@ -128,7 +129,7 @@ class Message(TelegramObject):
|
|||
"""*Optional*. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present"""
|
||||
forward_sender_name: Optional[str] = None
|
||||
"""*Optional*. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages"""
|
||||
forward_date: Optional[int] = None
|
||||
forward_date: Optional[datetime.datetime] = None
|
||||
"""*Optional*. For forwarded messages, date the original message was sent in Unix time"""
|
||||
is_topic_message: Optional[bool] = None
|
||||
"""*Optional*. :code:`True`, if the message is sent to a forum topic"""
|
||||
|
|
@ -160,6 +161,8 @@ class Message(TelegramObject):
|
|||
"""*Optional*. Message is a photo, available sizes of the photo"""
|
||||
sticker: Optional[Sticker] = None
|
||||
"""*Optional*. Message is a sticker, information about the sticker"""
|
||||
story: Optional[Story] = None
|
||||
"""*Optional*. Message is a forwarded story"""
|
||||
video: Optional[Video] = None
|
||||
"""*Optional*. Message is a video, information about the video"""
|
||||
video_note: Optional[VideoNote] = None
|
||||
|
|
@ -267,7 +270,7 @@ class Message(TelegramObject):
|
|||
forward_from_message_id: Optional[int] = None,
|
||||
forward_signature: Optional[str] = None,
|
||||
forward_sender_name: Optional[str] = None,
|
||||
forward_date: Optional[int] = None,
|
||||
forward_date: Optional[datetime.datetime] = None,
|
||||
is_topic_message: Optional[bool] = None,
|
||||
is_automatic_forward: Optional[bool] = None,
|
||||
reply_to_message: Optional[Message] = None,
|
||||
|
|
@ -283,6 +286,7 @@ class Message(TelegramObject):
|
|||
document: Optional[Document] = None,
|
||||
photo: Optional[List[PhotoSize]] = None,
|
||||
sticker: Optional[Sticker] = None,
|
||||
story: Optional[Story] = None,
|
||||
video: Optional[Video] = None,
|
||||
video_note: Optional[VideoNote] = None,
|
||||
voice: Optional[Voice] = None,
|
||||
|
|
@ -361,6 +365,7 @@ class Message(TelegramObject):
|
|||
document=document,
|
||||
photo=photo,
|
||||
sticker=sticker,
|
||||
story=story,
|
||||
video=video,
|
||||
video_note=video_note,
|
||||
voice=voice,
|
||||
|
|
@ -496,6 +501,8 @@ class Message(TelegramObject):
|
|||
return ContentType.USER_SHARED
|
||||
if self.chat_shared:
|
||||
return ContentType.CHAT_SHARED
|
||||
if self.story:
|
||||
return ContentType.STORY
|
||||
|
||||
return ContentType.UNKNOWN
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, List
|
||||
from typing import TYPE_CHECKING, Any, List, Optional
|
||||
|
||||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .chat import Chat
|
||||
from .user import User
|
||||
|
||||
|
||||
|
|
@ -17,10 +18,12 @@ class PollAnswer(TelegramObject):
|
|||
|
||||
poll_id: str
|
||||
"""Unique poll identifier"""
|
||||
user: User
|
||||
"""The user, who changed the answer to the poll"""
|
||||
option_ids: List[int]
|
||||
"""0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote."""
|
||||
"""0-based identifiers of chosen answer options. May be empty if the vote was retracted."""
|
||||
voter_chat: Optional[Chat] = None
|
||||
"""*Optional*. The chat that changed the answer to the poll, if the voter is anonymous"""
|
||||
user: Optional[User] = None
|
||||
"""*Optional*. The user that changed the answer to the poll, if the voter isn't anonymous"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
@ -30,8 +33,9 @@ class PollAnswer(TelegramObject):
|
|||
__pydantic__self__,
|
||||
*,
|
||||
poll_id: str,
|
||||
user: User,
|
||||
option_ids: List[int],
|
||||
voter_chat: Optional[Chat] = None,
|
||||
user: Optional[User] = None,
|
||||
**__pydantic_kwargs: Any,
|
||||
) -> None:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
|
|
@ -39,5 +43,9 @@ class PollAnswer(TelegramObject):
|
|||
# Is needed only for type checking and IDE support without any additional plugins
|
||||
|
||||
super().__init__(
|
||||
poll_id=poll_id, user=user, option_ids=option_ids, **__pydantic_kwargs
|
||||
poll_id=poll_id,
|
||||
option_ids=option_ids,
|
||||
voter_chat=voter_chat,
|
||||
user=user,
|
||||
**__pydantic_kwargs,
|
||||
)
|
||||
|
|
|
|||
9
aiogram/types/story.py
Normal file
9
aiogram/types/story.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from aiogram.types import TelegramObject
|
||||
|
||||
|
||||
class Story(TelegramObject):
|
||||
"""
|
||||
This object represents a message about a forwarded story in the chat. Currently holds no information.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#story
|
||||
"""
|
||||
Loading…
Add table
Add a link
Reference in a new issue