From 199fe29cf1e77a596424b1f02d0731e0ccf238ce Mon Sep 17 00:00:00 2001 From: Davte Date: Sun, 12 Nov 2023 11:55:03 +0100 Subject: [PATCH] Compliance with bot API 6.8 and 6.9 Added the method `unpinAllGeneralForumTopicMessages` (6.8). Added the new administrator privileges `can_post_stories`, `can_edit_stories` and `can_delete_stories` to the class `ChatAdministratorRights` and to the method `promoteChatMember` (6.9). --- davtelepot/__init__.py | 2 +- davtelepot/api.py | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index 173e16a..0a63125 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -11,7 +11,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.9.6" +__version__ = "2.9.7" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/api.py b/davtelepot/api.py index fbbe5eb..15223ea 100644 --- a/davtelepot/api.py +++ b/davtelepot/api.py @@ -150,7 +150,10 @@ class ChatAdministratorRights(dict): can_post_messages: bool = False, can_edit_messages: bool = False, can_pin_messages: bool = False, - can_manage_topics: bool = False): + can_manage_topics: bool = False, + can_post_stories: bool = False, + can_edit_stories : bool = False, + can_delete_stories: bool = False): """Represents the rights of an administrator in a chat. @param is_anonymous: True, if the user's presence in the chat is hidden @@ -194,6 +197,9 @@ class ChatAdministratorRights(dict): self['can_edit_messages'] = can_edit_messages self['can_pin_messages'] = can_pin_messages self['can_manage_topics'] = can_manage_topics + self['can_post_stories'] = can_post_stories + self['can_edit_stories'] = can_edit_stories + self['can_delete_stories'] = can_delete_stories class LabeledPrice(dict): @@ -1245,7 +1251,10 @@ class TelegramBot: can_promote_members: bool = None, can_manage_topics: bool = None, can_manage_chat: bool = None, - can_manage_video_chats: bool = None): + can_manage_video_chats: bool = None, + can_edit_stories: bool = None, + can_delete_stories: bool = None, + can_post_stories: bool = None): """Promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must @@ -2664,3 +2673,16 @@ class TelegramBot: 'deleteStickerSet', parameters=locals() ) + + async def unpinAllGeneralForumTopicMessages(self, chat_id: Union[int, str]): + """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. + See https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages for details. + """ + return await self.api_request( + 'unpinAllGeneralForumTopicMessages', + parameters=locals() + )