mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-17 21:22:40 +00:00
Merge branch 'develop' into asyncio
# Conflicts: # pyrogram/client/methods/messages/forward_messages.py # pyrogram/client/types/messages_and_media/message.py
This commit is contained in:
commit
a4217ab58b
@ -77,11 +77,13 @@ class ForwardMessages(BaseClient):
|
|||||||
message_ids = list(message_ids) if is_iterable else [message_ids]
|
message_ids = list(message_ids) if is_iterable else [message_ids]
|
||||||
|
|
||||||
if as_copy:
|
if as_copy:
|
||||||
sent_messages = []
|
forwarded_messages = []
|
||||||
|
|
||||||
for chunk in [message_ids[i:i + 200] for i in range(0, len(message_ids), 200)]:
|
for chunk in [message_ids[i:i + 200] for i in range(0, len(message_ids), 200)]:
|
||||||
messages = await self.get_messages(chat_id=from_chat_id, message_ids=chunk) # type: pyrogram.Messages
|
messages = await self.get_messages(chat_id=from_chat_id, message_ids=chunk) # type: pyrogram.Messages
|
||||||
|
|
||||||
for message in messages.messages:
|
for message in messages.messages:
|
||||||
sent_messages.append(
|
forwarded_messages.append(
|
||||||
await message.forward(
|
await message.forward(
|
||||||
chat_id,
|
chat_id,
|
||||||
disable_notification=disable_notification,
|
disable_notification=disable_notification,
|
||||||
@ -89,11 +91,12 @@ class ForwardMessages(BaseClient):
|
|||||||
remove_caption=remove_caption
|
remove_caption=remove_caption
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return pyrogram.Messages(
|
return pyrogram.Messages(
|
||||||
client=self,
|
client=self,
|
||||||
total_count=len(sent_messages),
|
total_count=len(forwarded_messages),
|
||||||
messages=sent_messages
|
messages=forwarded_messages
|
||||||
) if is_iterable else sent_messages[0]
|
) if is_iterable else forwarded_messages[0]
|
||||||
else:
|
else:
|
||||||
r = await self.send(
|
r = await self.send(
|
||||||
functions.messages.ForwardMessages(
|
functions.messages.ForwardMessages(
|
||||||
|
@ -2682,7 +2682,7 @@ class Message(PyrogramType, Update):
|
|||||||
raise ValueError("Unknown media type")
|
raise ValueError("Unknown media type")
|
||||||
|
|
||||||
if self.sticker or self.video_note: # Sticker and VideoNote should have no caption
|
if self.sticker or self.video_note: # Sticker and VideoNote should have no caption
|
||||||
return await send_media(file_id)
|
return await send_media(file_id=file_id)
|
||||||
else:
|
else:
|
||||||
return await send_media(file_id=file_id, caption=caption, parse_mode=ParseMode.HTML)
|
return await send_media(file_id=file_id, caption=caption, parse_mode=ParseMode.HTML)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user