Expose grouped parameter in forward_messages (default True)

This commit is contained in:
Lonami Exo 2019-04-11 12:47:14 +02:00
parent 9965cda968
commit cf3a4bc658

View File

@ -610,7 +610,7 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
return self._get_response_message(request, result, entity) return self._get_response_message(request, result, entity)
async def forward_messages(self, entity, messages, from_peer=None, async def forward_messages(self, entity, messages, from_peer=None,
*, silent=None): *, silent=None, grouped=True):
""" """
Forwards the given message(s) to the specified entity. Forwards the given message(s) to the specified entity.
@ -632,6 +632,12 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
channel or not. Defaults to ``False``, which means it will channel or not. Defaults to ``False``, which means it will
notify them. Set it to ``True`` to alter this behaviour. notify them. Set it to ``True`` to alter this behaviour.
grouped (`bool`, optional):
Whether several image messages should be forwarded grouped
(as an album) or not. If you want to forward albums, this
must be ``True``. Sending as album is the default
(``grouped=True``).
Returns: Returns:
The list of forwarded `telethon.tl.custom.message.Message`, The list of forwarded `telethon.tl.custom.message.Message`,
or a single one if a list wasn't provided as input. or a single one if a list wasn't provided as input.
@ -676,7 +682,8 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
from_peer=chat, from_peer=chat,
id=group, id=group,
to_peer=entity, to_peer=entity,
silent=silent silent=silent,
grouped=grouped
) )
result = await self(req) result = await self(req)
sent.extend(self._get_response_message(req, result, entity)) sent.extend(self._get_response_message(req, result, entity))