From 72b043b7438a29fe5cbaf99484d89464a9467619 Mon Sep 17 00:00:00 2001 From: wulan17 Date: Wed, 10 Dec 2025 22:55:36 +0700 Subject: [PATCH] pyrofork: Add ExportedFolderLink types Signed-off-by: wulan17 --- compiler/docs/compiler.py | 1 + pyrogram/methods/chats/export_folder_link.py | 2 +- pyrogram/types/user_and_chats/__init__.py | 2 + .../user_and_chats/exported_folder_link.py | 55 +++++++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 pyrogram/types/user_and_chats/exported_folder_link.py diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index f262a6b3..64b3dae9 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -518,6 +518,7 @@ def pyrogram_api(): Folder Restriction EmojiStatus + ExportedFolderLink ForumTopic PeerUser PeerChannel diff --git a/pyrogram/methods/chats/export_folder_link.py b/pyrogram/methods/chats/export_folder_link.py index 17141734..313a4c69 100644 --- a/pyrogram/methods/chats/export_folder_link.py +++ b/pyrogram/methods/chats/export_folder_link.py @@ -67,4 +67,4 @@ class ExportFolderLink: ) ) - return r.invite.url + return types.ExportedFolderLink._parse(r) diff --git a/pyrogram/types/user_and_chats/__init__.py b/pyrogram/types/user_and_chats/__init__.py index bc6c6ddc..4dd13126 100644 --- a/pyrogram/types/user_and_chats/__init__.py +++ b/pyrogram/types/user_and_chats/__init__.py @@ -42,6 +42,7 @@ from .chat_privileges import ChatPrivileges from .chat_reactions import ChatReactions from .dialog import Dialog from .emoji_status import EmojiStatus +from .exported_folder_link import ExportedFolderLink from .folder import Folder from .group_call_member import GroupCallMember from .invite_link_importer import InviteLinkImporter @@ -107,6 +108,7 @@ __all__ = [ "ChatPrivileges", "ChatJoiner", "EmojiStatus", + "ExportedFolderLink", "GroupCallMember", "ChatReactions" ] diff --git a/pyrogram/types/user_and_chats/exported_folder_link.py b/pyrogram/types/user_and_chats/exported_folder_link.py new file mode 100644 index 00000000..e8564c54 --- /dev/null +++ b/pyrogram/types/user_and_chats/exported_folder_link.py @@ -0,0 +1,55 @@ +# Pyrofork - Telegram MTProto API Client Library for Python +# Copyright (C) 2022-present Mayuri-Chan +# +# This file is part of Pyrogram. +# +# Pyrogram is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pyrogram is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . + +from typing import List, Union + +import pyrogram +from pyrogram import enums +from pyrogram import raw +from pyrogram import types +from pyrogram import utils +from ..object import Object + + +class ExportedFolderLink(Object): + """Describes an exported chat folder link. + + Parameters: + link (``str``): + The link itself. + + title (``str``, *optional*): + Title of the folder. + """ + + def __init__( + self, + link: str, + title: str = None + ): + super().__init__(None) + + self.link = link + self.title = title + + @staticmethod + def _parse(exported_folder_link: "raw.base.ExportedChatFolderLink") -> "ExportedFolderLink": + return ExportedFolderLink( + link=getattr(exported_folder_link, "link", None), + title=getattr(exported_folder_link, "title", None) + )