Skip to content

Commit 9cdb76c

Browse files
authored
Merge branch 'dev' into mc
2 parents edaf91c + ddad27a commit 9cdb76c

File tree

14 files changed

+274
-85
lines changed

14 files changed

+274
-85
lines changed

compiler/docs/compiler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ def get_title_list(s: str) -> list:
210210
get_chat_history_count
211211
read_chat_history
212212
get_messages
213+
get_chat_pinned_message
214+
get_callback_query_message
215+
get_replied_message
213216
view_messages
214217
get_discussion_message
215218
get_discussion_replies

docs/source/releases/changes-in-this-fork.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Breaking Changes in this Fork
1818
==============================
1919

2020
- In :meth:`~pyrogram.Client.download_media`, if the message is a :obj:`~pyrogram.types.PaidMediaInfo` with more than one ``paid_media`` **and** ``idx`` was not specified, then a list of paths or binary file-like objects is returned.
21-
- Make :meth:`~pyrogram.Client.get_messages` accept only keyword-only arguments. `48d4230 <https://github.com/TelegramPlayGround/pyrogram/commit/48d42304f3ee51034d515919320634935e6b2c83>`__
22-
- PR `#115 <https://github.com/TelegramPlayGround/pyrogram/pull/115>`__ This `change <https://github.com/pyrogram/pyrogram/pull/966#issuecomment-1108858881>`__ breaks some usages with offset-naive and offset-aware datetimes.
23-
- PR from upstream: `#1411 <https://github.com/pyrogram/pyrogram/pull/1411>`__ without attribution.
21+
- PR `#115 <https://github.com/TelegramPlayGround/pyrogram/pull/115>`_ This `change <https://github.com/pyrogram/pyrogram/pull/966#issuecomment-1108858881>`_ breaks some usages with offset-naive and offset-aware datetimes.
22+
- PR from upstream: `#1411 <https://github.com/pyrogram/pyrogram/pull/1411>`_ without attribution.
23+
2424

2525
Changes in this Fork
2626
=====================
@@ -36,8 +36,8 @@ Changes in this Fork
3636
+------------------------+
3737

3838
- Updated :doc:`Text Formatting <../../topics/text-formatting>` documentation.
39+
- Splitted the :meth:`~pyrogram.Client.get_messages` into :meth:`~pyrogram.Client.get_chat_pinned_message`, :meth:`~pyrogram.Client.get_callback_query_message`, and :meth:`~pyrogram.Client.get_replied_message`.
3940
- Added ``message.content`` property.
40-
- Added the parameter ``pinned`` and made the parameter ``chat_id`` optional in :meth:`~pyrogram.Client.get_messages`. **NOTE**: Please be aware about using the correct :doc:`Message Identifiers <../../topics/message-identifiers>`, when using this method.
4141
- Added the ``cover`` and ``start_timestamp`` parameters in :meth:`~pyrogram.Client.send_video` and :obj:`~pyrogram.types.InputPaidMediaVideo`.
4242
- Added the ``video_start_timestamp`` and renamed the ``send_copy`` and ``remove_caption`` parameters in :meth:`~pyrogram.Client.forward_messages` and :meth:`~pyrogram.types.Message.forward`.
4343
- Added the ``gift_count`` to the :obj:`~pyrogram.types.Chat`.

pyrogram/methods/chat_topics/get_forum_topic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

1919
import logging
20-
from typing import Union, Iterable
20+
from collections.abc import Iterable
21+
from typing import Union
2122

2223
import pyrogram
2324
from pyrogram import raw
@@ -59,7 +60,8 @@ async def get_forum_topic(
5960
Raises:
6061
ValueError: In case of invalid arguments.
6162
"""
62-
is_iterable = not isinstance(message_thread_ids, int)
63+
64+
is_iterable = isinstance(message_thread_ids, Iterable)
6365
ids = list(message_thread_ids) if is_iterable else [message_thread_ids]
6466

6567
r = await self.invoke(

pyrogram/methods/chats/get_send_as_chats.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from typing import Union
19+
from typing import Optional, Union
2020

2121
import pyrogram
22-
from pyrogram import raw
23-
from pyrogram import types
22+
from pyrogram import raw, types
2423

2524

2625
class GetSendAsChats:
2726
async def get_send_as_chats(
2827
self: "pyrogram.Client",
2928
chat_id: Union[int, str],
29+
for_paid_reactions: Optional[bool] = None
3030
) -> list["types.Chat"]:
3131
"""Get the list of "send_as" chats available.
3232
@@ -36,6 +36,9 @@ async def get_send_as_chats(
3636
chat_id (``int`` | ``str``):
3737
Unique identifier (int) or username (str) of the target chat.
3838
39+
for_paid_reactions (``bool``, *optional*):
40+
Pass True to get the list of available send_as chats for paid reactions.
41+
3942
Returns:
4043
List of :obj:`~pyrogram.types.Chat`: The list of chats.
4144
@@ -49,6 +52,7 @@ async def get_send_as_chats(
4952
r = await self.invoke(
5053
raw.functions.channels.GetSendAs(
5154
peer=await self.resolve_peer(chat_id),
55+
for_paid_reactions=for_paid_reactions
5256
)
5357
)
5458

@@ -58,9 +62,10 @@ async def get_send_as_chats(
5862
send_as_chats = types.List()
5963

6064
for p in r.peers:
61-
if isinstance(p, raw.types.PeerUser):
62-
send_as_chats.append(types.Chat._parse_chat(self, users[p.user_id]))
65+
# TODO
66+
if isinstance(p.peer, raw.types.PeerUser):
67+
send_as_chats.append(types.Chat._parse_chat(self, users[p.peer.user_id]))
6368
else:
64-
send_as_chats.append(types.Chat._parse_chat(self, chats[p.channel_id]))
69+
send_as_chats.append(types.Chat._parse_chat(self, chats[p.peer.channel_id]))
6570

6671
return send_as_chats

pyrogram/methods/messages/copy_message.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ async def copy_message(
3636
parse_mode: Optional["enums.ParseMode"] = None,
3737
caption_entities: list["types.MessageEntity"] = None,
3838
show_caption_above_media: bool = None,
39+
video_cover: Optional[Union[str, "io.BytesIO"]] = None,
40+
video_start_timestamp: int = None,
3941
disable_notification: bool = None,
4042
reply_parameters: "types.ReplyParameters" = None,
4143
reply_markup: Union[
@@ -89,6 +91,12 @@ async def copy_message(
8991
show_caption_above_media (``bool``, *optional*):
9092
Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified.
9193
94+
video_cover (``str`` | :obj:`io.BytesIO`, *optional*):
95+
New cover for the copied video in the message. Pass None to skip cover uploading and use the existing cover.
96+
97+
video_start_timestamp (``int``, *optional*):
98+
New start timestamp, from which the video playing must start, in seconds for the copied video in the message.
99+
92100
disable_notification (``bool``, *optional*):
93101
Sends the message silently.
94102
Users will receive a notification with no sound.
@@ -154,6 +162,8 @@ async def copy_message(
154162
parse_mode=parse_mode,
155163
caption_entities=caption_entities,
156164
show_caption_above_media=show_caption_above_media,
165+
video_cover=video_cover,
166+
video_start_timestamp=video_start_timestamp,
157167
disable_notification=disable_notification,
158168
reply_parameters=reply_parameters,
159169
reply_markup=reply_markup,

pyrogram/methods/messages/forward_messages.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
from collections.abc import Iterable
1920
from datetime import datetime
20-
from typing import Union, Iterable
21+
from typing import Union
2122

2223
import pyrogram
2324
from pyrogram import raw, utils
@@ -104,7 +105,7 @@ async def forward_messages(
104105
await app.forward_messages(to_chat, from_chat, [1, 2, 3])
105106
"""
106107

107-
is_iterable = not isinstance(message_ids, int)
108+
is_iterable = isinstance(message_ids, Iterable)
108109
message_ids = list(message_ids) if is_iterable else [message_ids]
109110

110111
r = await self.invoke(

0 commit comments

Comments
 (0)