Update API methods and types for Telegram Bot API 9.5

This commit is contained in:
JRoot Junior 2026-03-02 01:34:08 +02:00
parent 73710acb4c
commit 251df4b193
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
42 changed files with 575 additions and 72 deletions

View file

@ -126,6 +126,7 @@ from .set_business_account_profile_photo import SetBusinessAccountProfilePhoto
from .set_business_account_username import SetBusinessAccountUsername
from .set_chat_administrator_custom_title import SetChatAdministratorCustomTitle
from .set_chat_description import SetChatDescription
from .set_chat_member_tag import SetChatMemberTag
from .set_chat_menu_button import SetChatMenuButton
from .set_chat_permissions import SetChatPermissions
from .set_chat_photo import SetChatPhoto
@ -295,6 +296,7 @@ __all__ = (
"SetBusinessAccountUsername",
"SetChatAdministratorCustomTitle",
"SetChatDescription",
"SetChatMemberTag",
"SetChatMenuButton",
"SetChatPermissions",
"SetChatPhoto",

View file

@ -25,7 +25,7 @@ class EditMessageChecklist(TelegramMethod[Message]):
checklist: InputChecklist
"""A JSON-serialized object for the new checklist"""
reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for the new inline keyboard for the message"""
"""A JSON-serialized object for the new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_ for the message"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!

View file

@ -52,6 +52,8 @@ class PromoteChatMember(TelegramMethod[bool]):
"""Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"""
can_manage_direct_messages: bool | None = None
"""Pass :code:`True` if the administrator can manage direct messages within the channel and decline suggested posts; for channels only"""
can_manage_tags: bool | None = None
"""Pass :code:`True` if the administrator can edit the tags of regular members; for groups and supergroups only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -78,6 +80,7 @@ class PromoteChatMember(TelegramMethod[bool]):
can_pin_messages: bool | None = None,
can_manage_topics: bool | None = None,
can_manage_direct_messages: bool | None = None,
can_manage_tags: bool | None = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@ -103,5 +106,6 @@ class PromoteChatMember(TelegramMethod[bool]):
can_pin_messages=can_pin_messages,
can_manage_topics=can_manage_topics,
can_manage_direct_messages=can_manage_direct_messages,
can_manage_tags=can_manage_tags,
**__pydantic_kwargs,
)

View file

@ -31,7 +31,7 @@ class SendChecklist(TelegramMethod[Message]):
reply_parameters: ReplyParameters | None = None
"""A JSON-serialized object for description of the message to reply to"""
reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for an inline keyboard"""
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!

View file

@ -8,7 +8,7 @@ from .base import TelegramMethod
class SendMessageDraft(TelegramMethod[bool]):
"""
Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns :code:`True` on success.
Use this method to stream a partial message to a user while the message is being generated. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#sendmessagedraft
"""

View file

@ -0,0 +1,40 @@
from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion
from .base import TelegramMethod
class SetChatMemberTag(TelegramMethod[bool]):
"""
Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the *can_manage_tags* administrator right. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setchatmembertag
"""
__returning__ = bool
__api_method__ = "setChatMemberTag"
chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
user_id: int
"""Unique identifier of the target user"""
tag: str | None = None
"""New tag for the member; 0-16 characters, emoji are not allowed"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
chat_id: ChatIdUnion,
user_id: int,
tag: str | 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__(chat_id=chat_id, user_id=user_id, tag=tag, **__pydantic_kwargs)