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 +1 @@
|
||||||
6.7
|
6.8
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"meta": {},
|
||||||
|
"group": {
|
||||||
|
"title": "Available methods",
|
||||||
|
"anchor": "available-methods"
|
||||||
|
},
|
||||||
|
"object": {
|
||||||
|
"anchor": "unpinallgeneralforumtopicmessages",
|
||||||
|
"name": "unpinAllGeneralForumTopicMessages",
|
||||||
|
"description": "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 True on success.",
|
||||||
|
"html_description": "<p>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 <em>can_pin_messages</em> administrator right in the supergroup. Returns <em>True</em> on success.</p>",
|
||||||
|
"rst_description": "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.",
|
||||||
|
"annotations": [
|
||||||
|
{
|
||||||
|
"type": "Integer or String",
|
||||||
|
"required": true,
|
||||||
|
"description": "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)",
|
||||||
|
"html_description": "<td>Unique identifier for the target chat or username of the target supergroup (in the format <code>@supergroupusername</code>)</td>",
|
||||||
|
"rst_description": "Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)\n",
|
||||||
|
"name": "chat_id"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"category": "methods"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"api": {
|
"api": {
|
||||||
"version": "6.7",
|
"version": "6.8",
|
||||||
"release_date": "2023-04-21"
|
"release_date": "2023-08-18"
|
||||||
},
|
},
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
|
|
@ -547,6 +547,14 @@
|
||||||
"name": "emoji_status_custom_emoji_id",
|
"name": "emoji_status_custom_emoji_id",
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "Integer",
|
||||||
|
"description": "Expiration date of the emoji status of the other party in a private chat, if any. Returned only in getChat.",
|
||||||
|
"html_description": "<td><em>Optional</em>. Expiration date of the emoji status of the other party in a private chat, if any. Returned only in <a href=\"#getchat\">getChat</a>.</td>",
|
||||||
|
"rst_description": "*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`.\n",
|
||||||
|
"name": "emoji_status_expiration_date",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "String",
|
"type": "String",
|
||||||
"description": "Bio of the other party in a private chat. Returned only in getChat.",
|
"description": "Bio of the other party in a private chat. Returned only in getChat.",
|
||||||
|
|
@ -917,6 +925,14 @@
|
||||||
"name": "sticker",
|
"name": "sticker",
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "Story",
|
||||||
|
"description": "Message is a forwarded story",
|
||||||
|
"html_description": "<td><em>Optional</em>. Message is a forwarded story</td>",
|
||||||
|
"rst_description": "*Optional*. Message is a forwarded story\n",
|
||||||
|
"name": "story",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "Video",
|
"type": "Video",
|
||||||
"description": "Message is a video, information about the video",
|
"description": "Message is a video, information about the video",
|
||||||
|
|
@ -1628,6 +1644,15 @@
|
||||||
],
|
],
|
||||||
"category": "types"
|
"category": "types"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"anchor": "story",
|
||||||
|
"name": "Story",
|
||||||
|
"description": "This object represents a message about a forwarded story in the chat. Currently holds no information.",
|
||||||
|
"html_description": "<p>This object represents a message about a forwarded story in the chat. Currently holds no information.</p>",
|
||||||
|
"rst_description": "This object represents a message about a forwarded story in the chat. Currently holds no information.",
|
||||||
|
"annotations": [],
|
||||||
|
"category": "types"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"anchor": "video",
|
"anchor": "video",
|
||||||
"name": "Video",
|
"name": "Video",
|
||||||
|
|
@ -1935,19 +1960,27 @@
|
||||||
"name": "poll_id",
|
"name": "poll_id",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "Chat",
|
||||||
|
"description": "The chat that changed the answer to the poll, if the voter is anonymous",
|
||||||
|
"html_description": "<td><em>Optional</em>. The chat that changed the answer to the poll, if the voter is anonymous</td>",
|
||||||
|
"rst_description": "*Optional*. The chat that changed the answer to the poll, if the voter is anonymous\n",
|
||||||
|
"name": "voter_chat",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "User",
|
"type": "User",
|
||||||
"description": "The user, who changed the answer to the poll",
|
"description": "The user that changed the answer to the poll, if the voter isn't anonymous",
|
||||||
"html_description": "<td>The user, who changed the answer to the poll</td>",
|
"html_description": "<td><em>Optional</em>. The user that changed the answer to the poll, if the voter isn't anonymous</td>",
|
||||||
"rst_description": "The user, who changed the answer to the poll\n",
|
"rst_description": "*Optional*. The user that changed the answer to the poll, if the voter isn't anonymous\n",
|
||||||
"name": "user",
|
"name": "user",
|
||||||
"required": true
|
"required": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Array of Integer",
|
"type": "Array of Integer",
|
||||||
"description": "0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.",
|
"description": "0-based identifiers of chosen answer options. May be empty if the vote was retracted.",
|
||||||
"html_description": "<td>0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.</td>",
|
"html_description": "<td>0-based identifiers of chosen answer options. May be empty if the vote was retracted.</td>",
|
||||||
"rst_description": "0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.\n",
|
"rst_description": "0-based identifiers of chosen answer options. May be empty if the vote was retracted.\n",
|
||||||
"name": "option_ids",
|
"name": "option_ids",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
|
|
@ -7945,6 +7978,24 @@
|
||||||
],
|
],
|
||||||
"category": "methods"
|
"category": "methods"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"anchor": "unpinallgeneralforumtopicmessages",
|
||||||
|
"name": "unpinAllGeneralForumTopicMessages",
|
||||||
|
"description": "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 True on success.",
|
||||||
|
"html_description": "<p>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 <em>can_pin_messages</em> administrator right in the supergroup. Returns <em>True</em> on success.</p>",
|
||||||
|
"rst_description": "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.",
|
||||||
|
"annotations": [
|
||||||
|
{
|
||||||
|
"type": "Integer or String",
|
||||||
|
"required": true,
|
||||||
|
"description": "Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)",
|
||||||
|
"html_description": "<td>Unique identifier for the target chat or username of the target supergroup (in the format <code>@supergroupusername</code>)</td>",
|
||||||
|
"rst_description": "Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)\n",
|
||||||
|
"name": "chat_id"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"category": "methods"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"anchor": "answercallbackquery",
|
"anchor": "answercallbackquery",
|
||||||
"name": "answerCallbackQuery",
|
"name": "answerCallbackQuery",
|
||||||
|
|
|
||||||
|
|
@ -106,3 +106,7 @@ delete_photo:
|
||||||
set_photo:
|
set_photo:
|
||||||
method: setChatPhoto
|
method: setChatPhoto
|
||||||
fill: *self
|
fill: *self
|
||||||
|
|
||||||
|
unpin_all_general_forum_topic_messages:
|
||||||
|
method: unpinAllGeneralForumTopicMessages
|
||||||
|
fill: *self
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,14 @@
|
||||||
"name": "emoji_status_custom_emoji_id",
|
"name": "emoji_status_custom_emoji_id",
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "Integer",
|
||||||
|
"description": "Expiration date of the emoji status of the other party in a private chat, if any. Returned only in getChat.",
|
||||||
|
"html_description": "<td><em>Optional</em>. Expiration date of the emoji status of the other party in a private chat, if any. Returned only in <a href=\"#getchat\">getChat</a>.</td>",
|
||||||
|
"rst_description": "*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`.\n",
|
||||||
|
"name": "emoji_status_expiration_date",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "String",
|
"type": "String",
|
||||||
"description": "Bio of the other party in a private chat. Returned only in getChat.",
|
"description": "Bio of the other party in a private chat. Returned only in getChat.",
|
||||||
|
|
|
||||||
5
.butcher/types/Chat/replace.yml
Normal file
5
.butcher/types/Chat/replace.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
annotations:
|
||||||
|
emoji_status_expiration_date:
|
||||||
|
parsed_type:
|
||||||
|
type: std
|
||||||
|
name: datetime.datetime
|
||||||
|
|
@ -227,6 +227,14 @@
|
||||||
"name": "sticker",
|
"name": "sticker",
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "Story",
|
||||||
|
"description": "Message is a forwarded story",
|
||||||
|
"html_description": "<td><em>Optional</em>. Message is a forwarded story</td>",
|
||||||
|
"rst_description": "*Optional*. Message is a forwarded story\n",
|
||||||
|
"name": "story",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "Video",
|
"type": "Video",
|
||||||
"description": "Message is a video, information about the video",
|
"description": "Message is a video, information about the video",
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,7 @@ annotations:
|
||||||
parsed_type:
|
parsed_type:
|
||||||
type: std
|
type: std
|
||||||
name: datetime.datetime
|
name: datetime.datetime
|
||||||
|
forward_date:
|
||||||
|
parsed_type:
|
||||||
|
type: std
|
||||||
|
name: datetime.datetime
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,27 @@
|
||||||
"name": "poll_id",
|
"name": "poll_id",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "Chat",
|
||||||
|
"description": "The chat that changed the answer to the poll, if the voter is anonymous",
|
||||||
|
"html_description": "<td><em>Optional</em>. The chat that changed the answer to the poll, if the voter is anonymous</td>",
|
||||||
|
"rst_description": "*Optional*. The chat that changed the answer to the poll, if the voter is anonymous\n",
|
||||||
|
"name": "voter_chat",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "User",
|
"type": "User",
|
||||||
"description": "The user, who changed the answer to the poll",
|
"description": "The user that changed the answer to the poll, if the voter isn't anonymous",
|
||||||
"html_description": "<td>The user, who changed the answer to the poll</td>",
|
"html_description": "<td><em>Optional</em>. The user that changed the answer to the poll, if the voter isn't anonymous</td>",
|
||||||
"rst_description": "The user, who changed the answer to the poll\n",
|
"rst_description": "*Optional*. The user that changed the answer to the poll, if the voter isn't anonymous\n",
|
||||||
"name": "user",
|
"name": "user",
|
||||||
"required": true
|
"required": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Array of Integer",
|
"type": "Array of Integer",
|
||||||
"description": "0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.",
|
"description": "0-based identifiers of chosen answer options. May be empty if the vote was retracted.",
|
||||||
"html_description": "<td>0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.</td>",
|
"html_description": "<td>0-based identifiers of chosen answer options. May be empty if the vote was retracted.</td>",
|
||||||
"rst_description": "0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.\n",
|
"rst_description": "0-based identifiers of chosen answer options. May be empty if the vote was retracted.\n",
|
||||||
"name": "option_ids",
|
"name": "option_ids",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
.butcher/types/Story/entity.json
Normal file
16
.butcher/types/Story/entity.json
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"meta": {},
|
||||||
|
"group": {
|
||||||
|
"title": "Available types",
|
||||||
|
"anchor": "available-types"
|
||||||
|
},
|
||||||
|
"object": {
|
||||||
|
"anchor": "story",
|
||||||
|
"name": "Story",
|
||||||
|
"description": "This object represents a message about a forwarded story in the chat. Currently holds no information.",
|
||||||
|
"html_description": "<p>This object represents a message about a forwarded story in the chat. Currently holds no information.</p>",
|
||||||
|
"rst_description": "This object represents a message about a forwarded story in the chat. Currently holds no information.",
|
||||||
|
"annotations": [],
|
||||||
|
"category": "types"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
CHANGES/1275.misc.rst
Normal file
1
CHANGES/1275.misc.rst
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Added support for `Bot API 6.8 <https://core.telegram.org/bots/api-changelog#august-18-2023>`_
|
||||||
|
|
@ -52,7 +52,7 @@ Features
|
||||||
- Asynchronous (`asyncio docs <https://docs.python.org/3/library/asyncio.html>`_, :pep:`492`)
|
- Asynchronous (`asyncio docs <https://docs.python.org/3/library/asyncio.html>`_, :pep:`492`)
|
||||||
- Has type hints (:pep:`484`) and can be used with `mypy <http://mypy-lang.org/>`_
|
- Has type hints (:pep:`484`) and can be used with `mypy <http://mypy-lang.org/>`_
|
||||||
- Supports `PyPy <https://www.pypy.org/>`_
|
- Supports `PyPy <https://www.pypy.org/>`_
|
||||||
- Supports `Telegram Bot API 6.7 <https://core.telegram.org/bots/api>`_ and gets fast updates to the latest versions of the Bot API
|
- Supports `Telegram Bot API 6.8 <https://core.telegram.org/bots/api>`_ and gets fast updates to the latest versions of the Bot API
|
||||||
- Telegram Bot API integration code was `autogenerated <https://github.com/aiogram/tg-codegen>`_ and can be easily re-generated when API gets updated
|
- Telegram Bot API integration code was `autogenerated <https://github.com/aiogram/tg-codegen>`_ and can be easily re-generated when API gets updated
|
||||||
- Updates router (Blueprints)
|
- Updates router (Blueprints)
|
||||||
- Has Finite State Machine
|
- Has Finite State Machine
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
__version__ = "3.0.0rc2"
|
__version__ = "3.0.0rc2"
|
||||||
__api_version__ = "6.7"
|
__api_version__ = "6.8"
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ from ..methods import (
|
||||||
UnhideGeneralForumTopic,
|
UnhideGeneralForumTopic,
|
||||||
UnpinAllChatMessages,
|
UnpinAllChatMessages,
|
||||||
UnpinAllForumTopicMessages,
|
UnpinAllForumTopicMessages,
|
||||||
|
UnpinAllGeneralForumTopicMessages,
|
||||||
UnpinChatMessage,
|
UnpinChatMessage,
|
||||||
UploadStickerFile,
|
UploadStickerFile,
|
||||||
)
|
)
|
||||||
|
|
@ -4086,3 +4087,23 @@ class Bot:
|
||||||
language_code=language_code,
|
language_code=language_code,
|
||||||
)
|
)
|
||||||
return await self(call, request_timeout=request_timeout)
|
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"
|
DOCUMENT = "document"
|
||||||
PHOTO = "photo"
|
PHOTO = "photo"
|
||||||
STICKER = "sticker"
|
STICKER = "sticker"
|
||||||
|
STORY = "story"
|
||||||
VIDEO = "video"
|
VIDEO = "video"
|
||||||
VIDEO_NOTE = "video_note"
|
VIDEO_NOTE = "video_note"
|
||||||
VOICE = "voice"
|
VOICE = "voice"
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ from .unban_chat_sender_chat import UnbanChatSenderChat
|
||||||
from .unhide_general_forum_topic import UnhideGeneralForumTopic
|
from .unhide_general_forum_topic import UnhideGeneralForumTopic
|
||||||
from .unpin_all_chat_messages import UnpinAllChatMessages
|
from .unpin_all_chat_messages import UnpinAllChatMessages
|
||||||
from .unpin_all_forum_topic_messages import UnpinAllForumTopicMessages
|
from .unpin_all_forum_topic_messages import UnpinAllForumTopicMessages
|
||||||
|
from .unpin_all_general_forum_topic_messages import UnpinAllGeneralForumTopicMessages
|
||||||
from .unpin_chat_message import UnpinChatMessage
|
from .unpin_chat_message import UnpinChatMessage
|
||||||
from .upload_sticker_file import UploadStickerFile
|
from .upload_sticker_file import UploadStickerFile
|
||||||
|
|
||||||
|
|
@ -228,6 +229,7 @@ __all__ = (
|
||||||
"UnhideGeneralForumTopic",
|
"UnhideGeneralForumTopic",
|
||||||
"UnpinAllChatMessages",
|
"UnpinAllChatMessages",
|
||||||
"UnpinAllForumTopicMessages",
|
"UnpinAllForumTopicMessages",
|
||||||
|
"UnpinAllGeneralForumTopicMessages",
|
||||||
"UnpinChatMessage",
|
"UnpinChatMessage",
|
||||||
"UploadStickerFile",
|
"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 .shipping_query import ShippingQuery
|
||||||
from .sticker import Sticker
|
from .sticker import Sticker
|
||||||
from .sticker_set import StickerSet
|
from .sticker_set import StickerSet
|
||||||
|
from .story import Story
|
||||||
from .successful_payment import SuccessfulPayment
|
from .successful_payment import SuccessfulPayment
|
||||||
from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat
|
from .switch_inline_query_chosen_chat import SwitchInlineQueryChosenChat
|
||||||
from .update import Update
|
from .update import Update
|
||||||
|
|
@ -298,6 +299,7 @@ __all__ = (
|
||||||
"ShippingQuery",
|
"ShippingQuery",
|
||||||
"Sticker",
|
"Sticker",
|
||||||
"StickerSet",
|
"StickerSet",
|
||||||
|
"Story",
|
||||||
"SuccessfulPayment",
|
"SuccessfulPayment",
|
||||||
"SwitchInlineQueryChosenChat",
|
"SwitchInlineQueryChosenChat",
|
||||||
"TelegramObject",
|
"TelegramObject",
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ if TYPE_CHECKING:
|
||||||
UnbanChatSenderChat,
|
UnbanChatSenderChat,
|
||||||
UnpinAllChatMessages,
|
UnpinAllChatMessages,
|
||||||
UnpinChatMessage,
|
UnpinChatMessage,
|
||||||
|
UnpinAllGeneralForumTopicMessages,
|
||||||
)
|
)
|
||||||
from .chat_location import ChatLocation
|
from .chat_location import ChatLocation
|
||||||
from .chat_permissions import ChatPermissions
|
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`."""
|
"""*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
|
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`."""
|
"""*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
|
bio: Optional[str] = None
|
||||||
"""*Optional*. Bio of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
|
"""*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
|
has_private_forwards: Optional[bool] = None
|
||||||
|
|
@ -123,6 +126,7 @@ class Chat(TelegramObject):
|
||||||
photo: Optional[ChatPhoto] = None,
|
photo: Optional[ChatPhoto] = None,
|
||||||
active_usernames: Optional[List[str]] = None,
|
active_usernames: Optional[List[str]] = None,
|
||||||
emoji_status_custom_emoji_id: Optional[str] = None,
|
emoji_status_custom_emoji_id: Optional[str] = None,
|
||||||
|
emoji_status_expiration_date: Optional[datetime.datetime] = None,
|
||||||
bio: Optional[str] = None,
|
bio: Optional[str] = None,
|
||||||
has_private_forwards: Optional[bool] = None,
|
has_private_forwards: Optional[bool] = None,
|
||||||
has_restricted_voice_and_video_messages: Optional[bool] = None,
|
has_restricted_voice_and_video_messages: Optional[bool] = None,
|
||||||
|
|
@ -158,6 +162,7 @@ class Chat(TelegramObject):
|
||||||
photo=photo,
|
photo=photo,
|
||||||
active_usernames=active_usernames,
|
active_usernames=active_usernames,
|
||||||
emoji_status_custom_emoji_id=emoji_status_custom_emoji_id,
|
emoji_status_custom_emoji_id=emoji_status_custom_emoji_id,
|
||||||
|
emoji_status_expiration_date=emoji_status_expiration_date,
|
||||||
bio=bio,
|
bio=bio,
|
||||||
has_private_forwards=has_private_forwards,
|
has_private_forwards=has_private_forwards,
|
||||||
has_restricted_voice_and_video_messages=has_restricted_voice_and_video_messages,
|
has_restricted_voice_and_video_messages=has_restricted_voice_and_video_messages,
|
||||||
|
|
@ -1082,3 +1087,29 @@ class Chat(TelegramObject):
|
||||||
photo=photo,
|
photo=photo,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
).as_(self._bot)
|
).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_markup import ReplyKeyboardMarkup
|
||||||
from .reply_keyboard_remove import ReplyKeyboardRemove
|
from .reply_keyboard_remove import ReplyKeyboardRemove
|
||||||
from .sticker import Sticker
|
from .sticker import Sticker
|
||||||
|
from .story import Story
|
||||||
from .successful_payment import SuccessfulPayment
|
from .successful_payment import SuccessfulPayment
|
||||||
from .user import User
|
from .user import User
|
||||||
from .user_shared import UserShared
|
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"""
|
"""*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
|
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"""
|
"""*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"""
|
"""*Optional*. For forwarded messages, date the original message was sent in Unix time"""
|
||||||
is_topic_message: Optional[bool] = None
|
is_topic_message: Optional[bool] = None
|
||||||
"""*Optional*. :code:`True`, if the message is sent to a forum topic"""
|
"""*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"""
|
"""*Optional*. Message is a photo, available sizes of the photo"""
|
||||||
sticker: Optional[Sticker] = None
|
sticker: Optional[Sticker] = None
|
||||||
"""*Optional*. Message is a sticker, information about the sticker"""
|
"""*Optional*. Message is a sticker, information about the sticker"""
|
||||||
|
story: Optional[Story] = None
|
||||||
|
"""*Optional*. Message is a forwarded story"""
|
||||||
video: Optional[Video] = None
|
video: Optional[Video] = None
|
||||||
"""*Optional*. Message is a video, information about the video"""
|
"""*Optional*. Message is a video, information about the video"""
|
||||||
video_note: Optional[VideoNote] = None
|
video_note: Optional[VideoNote] = None
|
||||||
|
|
@ -267,7 +270,7 @@ class Message(TelegramObject):
|
||||||
forward_from_message_id: Optional[int] = None,
|
forward_from_message_id: Optional[int] = None,
|
||||||
forward_signature: Optional[str] = None,
|
forward_signature: Optional[str] = None,
|
||||||
forward_sender_name: 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_topic_message: Optional[bool] = None,
|
||||||
is_automatic_forward: Optional[bool] = None,
|
is_automatic_forward: Optional[bool] = None,
|
||||||
reply_to_message: Optional[Message] = None,
|
reply_to_message: Optional[Message] = None,
|
||||||
|
|
@ -283,6 +286,7 @@ class Message(TelegramObject):
|
||||||
document: Optional[Document] = None,
|
document: Optional[Document] = None,
|
||||||
photo: Optional[List[PhotoSize]] = None,
|
photo: Optional[List[PhotoSize]] = None,
|
||||||
sticker: Optional[Sticker] = None,
|
sticker: Optional[Sticker] = None,
|
||||||
|
story: Optional[Story] = None,
|
||||||
video: Optional[Video] = None,
|
video: Optional[Video] = None,
|
||||||
video_note: Optional[VideoNote] = None,
|
video_note: Optional[VideoNote] = None,
|
||||||
voice: Optional[Voice] = None,
|
voice: Optional[Voice] = None,
|
||||||
|
|
@ -361,6 +365,7 @@ class Message(TelegramObject):
|
||||||
document=document,
|
document=document,
|
||||||
photo=photo,
|
photo=photo,
|
||||||
sticker=sticker,
|
sticker=sticker,
|
||||||
|
story=story,
|
||||||
video=video,
|
video=video,
|
||||||
video_note=video_note,
|
video_note=video_note,
|
||||||
voice=voice,
|
voice=voice,
|
||||||
|
|
@ -496,6 +501,8 @@ class Message(TelegramObject):
|
||||||
return ContentType.USER_SHARED
|
return ContentType.USER_SHARED
|
||||||
if self.chat_shared:
|
if self.chat_shared:
|
||||||
return ContentType.CHAT_SHARED
|
return ContentType.CHAT_SHARED
|
||||||
|
if self.story:
|
||||||
|
return ContentType.STORY
|
||||||
|
|
||||||
return ContentType.UNKNOWN
|
return ContentType.UNKNOWN
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, List
|
from typing import TYPE_CHECKING, Any, List, Optional
|
||||||
|
|
||||||
from .base import TelegramObject
|
from .base import TelegramObject
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from .chat import Chat
|
||||||
from .user import User
|
from .user import User
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -17,10 +18,12 @@ class PollAnswer(TelegramObject):
|
||||||
|
|
||||||
poll_id: str
|
poll_id: str
|
||||||
"""Unique poll identifier"""
|
"""Unique poll identifier"""
|
||||||
user: User
|
|
||||||
"""The user, who changed the answer to the poll"""
|
|
||||||
option_ids: List[int]
|
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:
|
if TYPE_CHECKING:
|
||||||
# DO NOT EDIT MANUALLY!!!
|
# DO NOT EDIT MANUALLY!!!
|
||||||
|
|
@ -30,8 +33,9 @@ class PollAnswer(TelegramObject):
|
||||||
__pydantic__self__,
|
__pydantic__self__,
|
||||||
*,
|
*,
|
||||||
poll_id: str,
|
poll_id: str,
|
||||||
user: User,
|
|
||||||
option_ids: List[int],
|
option_ids: List[int],
|
||||||
|
voter_chat: Optional[Chat] = None,
|
||||||
|
user: Optional[User] = None,
|
||||||
**__pydantic_kwargs: Any,
|
**__pydantic_kwargs: Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
# DO NOT EDIT MANUALLY!!!
|
# DO NOT EDIT MANUALLY!!!
|
||||||
|
|
@ -39,5 +43,9 @@ class PollAnswer(TelegramObject):
|
||||||
# Is needed only for type checking and IDE support without any additional plugins
|
# Is needed only for type checking and IDE support without any additional plugins
|
||||||
|
|
||||||
super().__init__(
|
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
|
||||||
|
"""
|
||||||
|
|
@ -86,6 +86,7 @@ Available methods
|
||||||
unhide_general_forum_topic
|
unhide_general_forum_topic
|
||||||
unpin_all_chat_messages
|
unpin_all_chat_messages
|
||||||
unpin_all_forum_topic_messages
|
unpin_all_forum_topic_messages
|
||||||
|
unpin_all_general_forum_topic_messages
|
||||||
unpin_chat_message
|
unpin_chat_message
|
||||||
|
|
||||||
Payments
|
Payments
|
||||||
|
|
|
||||||
51
docs/api/methods/unpin_all_general_forum_topic_messages.rst
Normal file
51
docs/api/methods/unpin_all_general_forum_topic_messages.rst
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
#################################
|
||||||
|
unpinAllGeneralForumTopicMessages
|
||||||
|
#################################
|
||||||
|
|
||||||
|
Returns: :obj:`bool`
|
||||||
|
|
||||||
|
.. automodule:: aiogram.methods.unpin_all_general_forum_topic_messages
|
||||||
|
:members:
|
||||||
|
:member-order: bysource
|
||||||
|
:undoc-members: True
|
||||||
|
:exclude-members: model_config,model_fields
|
||||||
|
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
As bot method
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
result: bool = await bot.unpin_all_general_forum_topic_messages(...)
|
||||||
|
|
||||||
|
|
||||||
|
Method as object
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Imports:
|
||||||
|
|
||||||
|
- :code:`from aiogram.methods.unpin_all_general_forum_topic_messages import UnpinAllGeneralForumTopicMessages`
|
||||||
|
- alias: :code:`from aiogram.methods import UnpinAllGeneralForumTopicMessages`
|
||||||
|
|
||||||
|
With specific bot
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
result: bool = await bot(UnpinAllGeneralForumTopicMessages(...))
|
||||||
|
|
||||||
|
As reply into Webhook in handler
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
return UnpinAllGeneralForumTopicMessages(...)
|
||||||
|
|
||||||
|
|
||||||
|
As shortcut from received object
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
- :meth:`aiogram.types.chat.Chat.unpin_all_general_forum_topic_messages`
|
||||||
|
|
@ -123,6 +123,7 @@ Available types
|
||||||
reply_keyboard_markup
|
reply_keyboard_markup
|
||||||
reply_keyboard_remove
|
reply_keyboard_remove
|
||||||
response_parameters
|
response_parameters
|
||||||
|
story
|
||||||
switch_inline_query_chosen_chat
|
switch_inline_query_chosen_chat
|
||||||
user
|
user
|
||||||
user_profile_photos
|
user_profile_photos
|
||||||
|
|
|
||||||
10
docs/api/types/story.rst
Normal file
10
docs/api/types/story.rst
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#####
|
||||||
|
Story
|
||||||
|
#####
|
||||||
|
|
||||||
|
|
||||||
|
.. automodule:: aiogram.types.story
|
||||||
|
:members:
|
||||||
|
:member-order: bysource
|
||||||
|
:undoc-members: True
|
||||||
|
:exclude-members: model_config,model_fields
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
from aiogram.methods import Request, UnpinAllForumTopicMessages, UnpinAllGeneralForumTopicMessages
|
||||||
|
from tests.mocked_bot import MockedBot
|
||||||
|
|
||||||
|
|
||||||
|
class TestUnpinAllForumTopicMessages:
|
||||||
|
async def test_bot_method(self, bot: MockedBot):
|
||||||
|
prepare_result = bot.add_result_for(
|
||||||
|
UnpinAllGeneralForumTopicMessages, ok=True, result=True
|
||||||
|
)
|
||||||
|
|
||||||
|
response: bool = await bot.unpin_all_general_forum_topic_messages(
|
||||||
|
chat_id=42,
|
||||||
|
)
|
||||||
|
request = bot.get_request()
|
||||||
|
assert response == prepare_result.result
|
||||||
|
|
@ -207,3 +207,9 @@ class TestChat:
|
||||||
):
|
):
|
||||||
chat = Chat(id=42, first_name=first, last_name=last, title=title, type=chat_type)
|
chat = Chat(id=42, first_name=first, last_name=last, title=title, type=chat_type)
|
||||||
assert chat.full_name == result
|
assert chat.full_name == result
|
||||||
|
|
||||||
|
def test_unpin_all_general_forum_topic_messages(self):
|
||||||
|
chat = Chat(id=-42, type="supergroup")
|
||||||
|
|
||||||
|
method = chat.unpin_all_general_forum_topic_messages()
|
||||||
|
assert method.chat_id == chat.id
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ from aiogram.types import (
|
||||||
VideoNote,
|
VideoNote,
|
||||||
Voice,
|
Voice,
|
||||||
WebAppData,
|
WebAppData,
|
||||||
|
Story,
|
||||||
)
|
)
|
||||||
from aiogram.types.message import ContentType, Message
|
from aiogram.types.message import ContentType, Message
|
||||||
|
|
||||||
|
|
@ -455,6 +456,15 @@ TEST_CHAT_SHARED = Message(
|
||||||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||||
chat_shared=ChatShared(request_id=42, chat_id=42),
|
chat_shared=ChatShared(request_id=42, chat_id=42),
|
||||||
)
|
)
|
||||||
|
TEST_MESSAGE_STORY = Message(
|
||||||
|
message_id=42,
|
||||||
|
date=datetime.datetime.now(),
|
||||||
|
chat=Chat(id=42, type="private"),
|
||||||
|
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||||
|
story=Story(),
|
||||||
|
forward_signature="Test",
|
||||||
|
forward_date=datetime.datetime.now(),
|
||||||
|
)
|
||||||
TEST_MESSAGE_UNKNOWN = Message(
|
TEST_MESSAGE_UNKNOWN = Message(
|
||||||
message_id=42,
|
message_id=42,
|
||||||
date=datetime.datetime.now(),
|
date=datetime.datetime.now(),
|
||||||
|
|
@ -516,6 +526,7 @@ class TestMessage:
|
||||||
[TEST_FORUM_TOPIC_REOPENED, ContentType.FORUM_TOPIC_REOPENED],
|
[TEST_FORUM_TOPIC_REOPENED, ContentType.FORUM_TOPIC_REOPENED],
|
||||||
[TEST_USER_SHARED, ContentType.USER_SHARED],
|
[TEST_USER_SHARED, ContentType.USER_SHARED],
|
||||||
[TEST_CHAT_SHARED, ContentType.CHAT_SHARED],
|
[TEST_CHAT_SHARED, ContentType.CHAT_SHARED],
|
||||||
|
[TEST_MESSAGE_STORY, ContentType.STORY],
|
||||||
[TEST_MESSAGE_UNKNOWN, ContentType.UNKNOWN],
|
[TEST_MESSAGE_UNKNOWN, ContentType.UNKNOWN],
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue