Added full support of Bot API 6.5 (#1112)

* Added full support of Bot API 6.5

* Shut up, linters (Fixed errors)

* Oops. Added lost files.

* Fixed tests

* Added changes description

* Update description from docs

* Fixed anchors

* Update Butcher

* Added danger zone to changelog

* Type
This commit is contained in:
Alex Root Junior 2023-02-04 19:53:32 +02:00 committed by GitHub
parent 3428924d63
commit e59d4652bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 1218 additions and 184 deletions

View file

@ -29,7 +29,7 @@ class GetChatMember(
]
):
"""
Use this method to get information about a member of a chat. The method is guaranteed to work for other users, only if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a :class:`aiogram.types.chat_member.ChatMember` object on success.
Source: https://core.telegram.org/bots/api#getchatmember
"""

View file

@ -36,7 +36,7 @@ class PromoteChatMember(TelegramMethod[bool]):
can_restrict_members: Optional[bool] = None
"""Pass :code:`True` if the administrator can restrict, ban or unban chat members"""
can_promote_members: Optional[bool] = None
"""Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
"""Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
can_change_info: Optional[bool] = None
"""Pass :code:`True` if the administrator can change chat title, photo and other settings"""
can_invite_users: Optional[bool] = None

View file

@ -25,6 +25,8 @@ class RestrictChatMember(TelegramMethod[bool]):
"""Unique identifier of the target user"""
permissions: ChatPermissions
"""A JSON-serialized object for new user permissions"""
use_independent_chat_permissions: Optional[bool] = None
"""Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission."""
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
"""Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever"""

View file

@ -1,6 +1,6 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Union
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from ..types import ChatPermissions
from .base import Request, TelegramMethod
@ -22,6 +22,8 @@ class SetChatPermissions(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
permissions: ChatPermissions
"""A JSON-serialized object for new default chat permissions"""
use_independent_chat_permissions: Optional[bool] = None
"""Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()