Skip to content

Commit

Permalink
pyrofork: Bump version to 2.3.54
Browse files Browse the repository at this point in the history
Signed-off-by: Yasir Aris <[email protected]>
  • Loading branch information
yasirarism committed Jan 4, 2025
1 parent 6c538f0 commit 8ceec29
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
5 changes: 2 additions & 3 deletions compiler/docs/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def get_title_list(s: str) -> list:
GiftCode
GiftedPremium
Gift
UserGift
StarGift
InputStarsTransaction
Invoice
LabeledPrice
Expand All @@ -600,7 +600,6 @@ def get_title_list(s: str) -> list:
StarsStatus
StarsTransaction
SuccessfulPayment
UserStarGift
""",
pyromod="""
Pyromod
Expand Down Expand Up @@ -928,4 +927,4 @@ def start():
DESTINATION = "../../docs/source/telegram"
PYROGRAM_API_DEST = "../../docs/source/api"

start()
start()
2 changes: 1 addition & 1 deletion pyrogram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with Pyrofork. If not, see <http://www.gnu.org/licenses/>.

__fork_name__ = "PyroFork"
__version__ = "2.3.53"
__version__ = "2.3.54"
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
__copyright__ = "Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>"

Expand Down
10 changes: 5 additions & 5 deletions pyrogram/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ async def gift_code_filter(_, __, m: Message):
"""Filter messages that contain :obj:`~pyrogram.types.GiftCode` objects."""
# endregion

# region user_gift
async def user_gift_filter(_, __, m: Message):
return bool(m.user_gift)
user_gift = create(user_gift_filter)
"""Filter messages that contain :obj:`~pyrogram.types.UserGift` objects."""
# region star_gift_filter
async def star_gift_filter(_, __, m: Message):
return bool(m.star_gift)
star_gift = create(star_gift_filter)
"""Filter messages that contain :obj:`~pyrogram.types.StarGift` objects."""
# endregion

# region video_filter
Expand Down
6 changes: 3 additions & 3 deletions pyrogram/methods/business/get_user_gifts.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def get_user_gifts(
user_id: Union[int, str],
offset: str = "",
limit: int = 0,
) -> Optional[AsyncGenerator["types.UserGift", None]]:
) -> Optional[AsyncGenerator["types.StarGift", None]]:
"""Get gifts saved to profile by the given user.
.. include:: /_includes/usable-by/users.rst
Expand Down Expand Up @@ -70,13 +70,13 @@ async def get_user_gifts(
offset=offset,
limit=limit
),
sleep_threshold=max(60, self.sleep_threshold)
sleep_threshold=60
)

users = {u.id: u for u in r.users}

user_gifts = [
await types.UserGift._parse(self, gift, users)
await types.StarGift._parse_user_star_gift(self, gift, users)
for gift in r.gifts
]

Expand Down
20 changes: 18 additions & 2 deletions pyrogram/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
from types import SimpleNamespace

import pyrogram
from pyrogram import raw, enums
from pyrogram import types
from pyrogram import raw, enums, types
from pyrogram.types.messages_and_media.message import Str
from pyrogram.file_id import FileId, FileType, PHOTO_TYPES, DOCUMENT_TYPES


Expand Down Expand Up @@ -477,6 +477,22 @@ async def run_sync(func: Callable[..., TypeVar("Result")], *args: Any, **kwargs:
loop = asyncio.get_event_loop()
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(
client: "pyrogram.Client",
chat_id: Union[int,str] = None,
Expand Down

0 comments on commit 8ceec29

Please sign in to comment.