mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added full support of the Bot API 9.4 (#1761)
* Bump API schema to version 9.4, add new object types, methods, and properties.
* Add tests for `ChatOwnerChanged` and `ChatOwnerLeft` message types
* Add tests for `GetUserProfileAudios`, `RemoveMyProfilePhoto`, and `SetMyProfilePhoto` methods
* Bump version
* Update Makefile variables and refactor `test_get_user_profile_audios.py`
* Document new features and updates from Bot API 9.4 in changelog
* Add `ButtonStyle` enum to represent button styles in the Telegram API
* Fix review issues from PR #1761
- Remove stray '-' artifact from GameHighScore docstring and butcher schema
- Fix Makefile reformat target scope inconsistency (ruff check --fix)
- Fix ButtonStyle enum source URL (#chat -> #inlinekeyboardbutton)
- Add User.get_profile_audios() shortcut method (parallel to get_profile_photos)
- Test ChatOwnerLeft with new_owner=None (edge case)
- Add VideoQuality type and Video.qualities nesting tests
- Add User.get_profile_audios() test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Revert "Fix review issues from PR #1761"
This reverts commit 2184e98988.
* Update source links for `ButtonStyle` documentation to reflect accurate API references
* Fix review issues from PR #1761 (#1762)
* Fix review issues from PR #1761
- Remove stray '-' artifact from GameHighScore docstring
- Fix Makefile reformat target scope inconsistency (ruff check --fix)
- Add User.get_profile_audios() shortcut method (parallel to get_profile_photos)
- Test ChatOwnerLeft with new_owner=None (edge case)
- Add VideoQuality type and Video.qualities nesting tests
- Add User.get_profile_audios() test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review comments: use fixture and variables in tests, add changelog
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review follow-ups for PR #1762
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Reformat code
* Shut up, ruff
---------
Co-authored-by: latand <latand666@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Kostiantyn Kriuchkov <36363097+Latand@users.noreply.github.com>
This commit is contained in:
parent
da7bfdca0c
commit
49d0784e33
67 changed files with 1457 additions and 61 deletions
|
|
@ -74,6 +74,7 @@ from .get_sticker_set import GetStickerSet
|
|||
from .get_updates import GetUpdates
|
||||
from .get_user_chat_boosts import GetUserChatBoosts
|
||||
from .get_user_gifts import GetUserGifts
|
||||
from .get_user_profile_audios import GetUserProfileAudios
|
||||
from .get_user_profile_photos import GetUserProfilePhotos
|
||||
from .get_webhook_info import GetWebhookInfo
|
||||
from .gift_premium_subscription import GiftPremiumSubscription
|
||||
|
|
@ -87,6 +88,7 @@ from .read_business_message import ReadBusinessMessage
|
|||
from .refund_star_payment import RefundStarPayment
|
||||
from .remove_business_account_profile_photo import RemoveBusinessAccountProfilePhoto
|
||||
from .remove_chat_verification import RemoveChatVerification
|
||||
from .remove_my_profile_photo import RemoveMyProfilePhoto
|
||||
from .remove_user_verification import RemoveUserVerification
|
||||
from .reopen_forum_topic import ReopenForumTopic
|
||||
from .reopen_general_forum_topic import ReopenGeneralForumTopic
|
||||
|
|
@ -136,6 +138,7 @@ from .set_my_commands import SetMyCommands
|
|||
from .set_my_default_administrator_rights import SetMyDefaultAdministratorRights
|
||||
from .set_my_description import SetMyDescription
|
||||
from .set_my_name import SetMyName
|
||||
from .set_my_profile_photo import SetMyProfilePhoto
|
||||
from .set_my_short_description import SetMyShortDescription
|
||||
from .set_passport_data_errors import SetPassportDataErrors
|
||||
from .set_sticker_emoji_list import SetStickerEmojiList
|
||||
|
|
@ -238,6 +241,7 @@ __all__ = (
|
|||
"GetUpdates",
|
||||
"GetUserChatBoosts",
|
||||
"GetUserGifts",
|
||||
"GetUserProfileAudios",
|
||||
"GetUserProfilePhotos",
|
||||
"GetWebhookInfo",
|
||||
"GiftPremiumSubscription",
|
||||
|
|
@ -251,6 +255,7 @@ __all__ = (
|
|||
"RefundStarPayment",
|
||||
"RemoveBusinessAccountProfilePhoto",
|
||||
"RemoveChatVerification",
|
||||
"RemoveMyProfilePhoto",
|
||||
"RemoveUserVerification",
|
||||
"ReopenForumTopic",
|
||||
"ReopenGeneralForumTopic",
|
||||
|
|
@ -302,6 +307,7 @@ __all__ = (
|
|||
"SetMyDefaultAdministratorRights",
|
||||
"SetMyDescription",
|
||||
"SetMyName",
|
||||
"SetMyProfilePhoto",
|
||||
"SetMyShortDescription",
|
||||
"SetPassportDataErrors",
|
||||
"SetStickerEmojiList",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from .base import TelegramMethod
|
|||
|
||||
class CreateForumTopic(TelegramMethod[ForumTopic]):
|
||||
"""
|
||||
Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator rights. Returns information about the created topic as a :class:`aiogram.types.forum_topic.ForumTopic` object.
|
||||
Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the *can_manage_topics* administrator right. Returns information about the created topic as a :class:`aiogram.types.forum_topic.ForumTopic` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#createforumtopic
|
||||
"""
|
||||
|
|
|
|||
42
aiogram/methods/get_user_profile_audios.py
Normal file
42
aiogram/methods/get_user_profile_audios.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from ..types import UserProfileAudios
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class GetUserProfileAudios(TelegramMethod[UserProfileAudios]):
|
||||
"""
|
||||
Use this method to get a list of profile audios for a user. Returns a :class:`aiogram.types.user_profile_audios.UserProfileAudios` object.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#getuserprofileaudios
|
||||
"""
|
||||
|
||||
__returning__ = UserProfileAudios
|
||||
__api_method__ = "getUserProfileAudios"
|
||||
|
||||
user_id: int
|
||||
"""Unique identifier of the target user"""
|
||||
offset: int | None = None
|
||||
"""Sequential number of the first audio to be returned. By default, all audios are returned."""
|
||||
limit: int | None = None
|
||||
"""Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__,
|
||||
*,
|
||||
user_id: int,
|
||||
offset: int | None = None,
|
||||
limit: int | None = None,
|
||||
**__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__(user_id=user_id, offset=offset, limit=limit, **__pydantic_kwargs)
|
||||
14
aiogram/methods/remove_my_profile_photo.py
Normal file
14
aiogram/methods/remove_my_profile_photo.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class RemoveMyProfilePhoto(TelegramMethod[bool]):
|
||||
"""
|
||||
Removes the profile photo of the bot. Requires no parameters. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#removemyprofilephoto
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
__api_method__ = "removeMyProfilePhoto"
|
||||
33
aiogram/methods/set_my_profile_photo.py
Normal file
33
aiogram/methods/set_my_profile_photo.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from ..types import InputProfilePhotoUnion
|
||||
from .base import TelegramMethod
|
||||
|
||||
|
||||
class SetMyProfilePhoto(TelegramMethod[bool]):
|
||||
"""
|
||||
Changes the profile photo of the bot. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#setmyprofilephoto
|
||||
"""
|
||||
|
||||
__returning__ = bool
|
||||
__api_method__ = "setMyProfilePhoto"
|
||||
|
||||
photo: InputProfilePhotoUnion
|
||||
"""The new profile photo to set"""
|
||||
|
||||
if TYPE_CHECKING:
|
||||
# DO NOT EDIT MANUALLY!!!
|
||||
# This section was auto-generated via `butcher`
|
||||
|
||||
def __init__(
|
||||
__pydantic__self__, *, photo: InputProfilePhotoUnion, **__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__(photo=photo, **__pydantic_kwargs)
|
||||
Loading…
Add table
Add a link
Reference in a new issue