Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feat: Docstring changes + moving limit to constants#3343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Poolitzer merged 3 commits intoapi_6.3_updatefrom6.3_docstring
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletiontelegram/_bot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -775,6 +775,7 @@ async def delete_message(
limitations:

- A message can only be deleted if it was sent less than 48 hours ago.
- Service messages about a supergroup, channel, or forum topic creation can't be deleted.
- A dice message in a private chat can only be deleted if it was sent more than 24
hours ago.
- Bots can delete outgoing messages in private chats, groups, and supergroups.
Expand DownExpand Up@@ -6171,7 +6172,9 @@ async def set_chat_title(
Args:
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username
of the target channel (in the format ``@channelusername``).
title (:obj:`str`): New chat title, 1-255 characters.
title (:obj:`str`): New chat title,
tg-const:`telegram.constants.ChatLimits.MIN_TITLE_LENGTH`-
tg-const:`telegram.constants.ChatLimits.MAX_TITLE_LENGTH` characters.

Keyword Args:
read_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
Expand Down
2 changes: 1 addition & 1 deletiontelegram/_chat.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -266,7 +266,7 @@ class Chat(TelegramObject):
"has_restricted_voice_and_video_messages",
"is_forum",
"active_usernames",
"emoji_status_custom_emoji_id"
"emoji_status_custom_emoji_id",
)

SENDER: ClassVar[str] = constants.ChatType.SENDER
Expand Down
16 changes: 16 additions & 0 deletionstelegram/constants.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@
"ChatAction",
"ChatID",
"ChatInviteLinkLimit",
"ChatLimit",
"ChatMemberStatus",
"ChatType",
"CustomEmojiStickerLimit",
Expand DownExpand Up@@ -901,3 +902,18 @@ class WebhookLimit(IntEnum):
""":obj:`int`: Minimum length of the secret token."""
MAX_SECRET_TOKEN_LENGTH = 256
""":obj:`int`: Maximum length of the secret token."""


class ChatLimit(IntEnum):
"""This enum contains limitations for :paramref:`telegram.Bot.set_chat_title.title`. The
enum members of this enumeration are instances of :class:`int` and can be treated as such.

.. versionadded:: 20.0
"""

__slots__ = ()

MIN_TITLE_LENGTH = 1
""":obj:`int`: Minimum length of a new chat title."""
MAX_TITLE_LENGTH = 128
""":obj:`int`: Maximum length of a new chat title."""
2 changes: 1 addition & 1 deletiontests/test_chat.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -106,7 +106,7 @@ def test_de_json(self, bot):
),
"is_forum": self.is_forum,
"active_usernames": self.active_usernames,
"emoji_status_custom_emoji_id": self.emoji_status_custom_emoji_id
"emoji_status_custom_emoji_id": self.emoji_status_custom_emoji_id,
}
chat = Chat.de_json(json_dict, bot)

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp