pyrofork: Bump version to 2.3.54

Signed-off-by: Yasir Aris <git@yasir.id>
This commit is contained in:
Yasir Aris 2025-01-04 16:31:40 +07:00
parent 6c538f026d
commit 8ceec293ba
5 changed files with 29 additions and 14 deletions

View file

@ -588,7 +588,7 @@ def pyrogram_api():
GiftCode GiftCode
GiftedPremium GiftedPremium
Gift Gift
UserGift StarGift
InputStarsTransaction InputStarsTransaction
Invoice Invoice
LabeledPrice LabeledPrice
@ -600,7 +600,6 @@ def pyrogram_api():
StarsStatus StarsStatus
StarsTransaction StarsTransaction
SuccessfulPayment SuccessfulPayment
UserStarGift
""", """,
pyromod=""" pyromod="""
Pyromod Pyromod

View file

@ -18,7 +18,7 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>. # along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.
__fork_name__ = "PyroFork" __fork_name__ = "PyroFork"
__version__ = "2.3.53" __version__ = "2.3.54"
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)" __license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
__copyright__ = "Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>" __copyright__ = "Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>"

View file

@ -358,11 +358,11 @@ gift_code = create(gift_code_filter)
"""Filter messages that contain :obj:`~pyrogram.types.GiftCode` objects.""" """Filter messages that contain :obj:`~pyrogram.types.GiftCode` objects."""
# endregion # endregion
# region user_gift # region star_gift_filter
async def user_gift_filter(_, __, m: Message): async def star_gift_filter(_, __, m: Message):
return bool(m.user_gift) return bool(m.star_gift)
user_gift = create(user_gift_filter) star_gift = create(star_gift_filter)
"""Filter messages that contain :obj:`~pyrogram.types.UserGift` objects.""" """Filter messages that contain :obj:`~pyrogram.types.StarGift` objects."""
# endregion # endregion
# region video_filter # region video_filter

View file

@ -28,7 +28,7 @@ class GetUserGifts:
user_id: Union[int, str], user_id: Union[int, str],
offset: str = "", offset: str = "",
limit: int = 0, limit: int = 0,
) -> Optional[AsyncGenerator["types.UserGift", None]]: ) -> Optional[AsyncGenerator["types.StarGift", None]]:
"""Get gifts saved to profile by the given user. """Get gifts saved to profile by the given user.
.. include:: /_includes/usable-by/users.rst .. include:: /_includes/usable-by/users.rst
@ -70,13 +70,13 @@ class GetUserGifts:
offset=offset, offset=offset,
limit=limit limit=limit
), ),
sleep_threshold=max(60, self.sleep_threshold) sleep_threshold=60
) )
users = {u.id: u for u in r.users} users = {u.id: u for u in r.users}
user_gifts = [ user_gifts = [
await types.UserGift._parse(self, gift, users) await types.StarGift._parse_user_star_gift(self, gift, users)
for gift in r.gifts for gift in r.gifts
] ]

View file

@ -30,8 +30,8 @@ from typing import Union, List, Dict, Optional, Any, Callable, TypeVar
from types import SimpleNamespace from types import SimpleNamespace
import pyrogram import pyrogram
from pyrogram import raw, enums from pyrogram import raw, enums, types
from pyrogram import types from pyrogram.types.messages_and_media.message import Str
from pyrogram.file_id import FileId, FileType, PHOTO_TYPES, DOCUMENT_TYPES from pyrogram.file_id import FileId, FileType, PHOTO_TYPES, DOCUMENT_TYPES
@ -477,6 +477,22 @@ async def run_sync(func: Callable[..., TypeVar("Result")], *args: Any, **kwargs:
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, functools.partial(func, *args, **kwargs)) return await loop.run_in_executor(None, functools.partial(func, *args, **kwargs))
def parse_text_with_entities(client, message: "raw.types.TextWithEntities", users):
entities = types.List(
filter(
lambda x: x is not None,
[
types.MessageEntity._parse(client, entity, users)
for entity in getattr(message, "entities", [])
]
)
)
return {
"text": Str(getattr(message, "text", "")).init(entities) or None,
"entities": entities or None
}
async def get_reply_to( async def get_reply_to(
client: "pyrogram.Client", client: "pyrogram.Client",
chat_id: Union[int,str] = None, chat_id: Union[int,str] = None,