Queer European MD passionate about IT
Quellcode durchsuchen

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).
Davte vor 6 Monaten
Ursprung
Commit
199fe29cf1
2 geänderte Dateien mit 25 neuen und 3 gelöschten Zeilen
  1. 1 1
      davtelepot/__init__.py
  2. 24 2
      davtelepot/api.py

+ 1 - 1
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"
 

+ 24 - 2
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()
+        )