Send multiphoto messages in order

This commit is contained in:
Andrew Ferrazzutti 2022-03-29 03:25:38 -04:00
parent d116ebefc7
commit 15415a5eec
1 changed files with 23 additions and 25 deletions

View File

@ -1050,7 +1050,7 @@ class Portal(DBPortal, BasePortal):
source, intent, attachment, timestamp, message_text source, intent, attachment, timestamp, message_text
)) ))
def _handle_remote_multiphoto( async def _handle_remote_multiphoto(
self, self,
source: u.User, source: u.User,
intent: IntentAPI, intent: IntentAPI,
@ -1059,30 +1059,28 @@ class Portal(DBPortal, BasePortal):
message_text: str | None, message_text: str | None,
) -> Awaitable[list[EventID]]: ) -> Awaitable[list[EventID]]:
# TODO Upload media concurrently, but post messages sequentially # TODO Upload media concurrently, but post messages sequentially
return asyncio.gather( return [
*[ await self._handle_remote_uniphoto(
self._handle_remote_uniphoto( source, intent,
source, intent, PhotoAttachment(
PhotoAttachment( shout=attachment.shout,
shout=attachment.shout, mentions=attachment.mentions,
mentions=attachment.mentions, urls=attachment.urls,
urls=attachment.urls, url=attachment.imageUrls[i],
url=attachment.imageUrls[i], s=attachment.sl[i],
s=attachment.sl[i], k=attachment.kl[i],
k=attachment.kl[i], w=attachment.wl[i],
w=attachment.wl[i], h=attachment.hl[i],
h=attachment.hl[i], thumbnailUrl=attachment.thumbnailUrls[i],
thumbnailUrl=attachment.thumbnailUrls[i], thumbnailWidth=attachment.thumbnailWidths[i],
thumbnailWidth=attachment.thumbnailWidths[i], thumbnailHeight=attachment.thumbnailHeights[i],
thumbnailHeight=attachment.thumbnailHeights[i], cs=attachment.csl[i],
cs=attachment.csl[i], mt=attachment.mtl[i],
mt=attachment.mtl[i], ),
), timestamp, message_text,
timestamp, message_text, )
) for i in range(len(attachment.imageUrls))
for i in range(len(attachment.imageUrls)) ]
]
)
def _handle_remote_uniphoto( def _handle_remote_uniphoto(
self, self,