Skip to content
Snippets Groups Projects
Commit 799c7145 authored by Tulir Asokan's avatar Tulir Asokan :cat2:
Browse files

Switch to fbchat-asyncio mqtt branch

parent adc89b07
No related branches found
No related tags found
No related merge requests found
......@@ -188,6 +188,8 @@ class Portal:
@staticmethod
async def _reupload_fb_photo(url: str, intent: IntentAPI, filename: Optional[str] = None
) -> Tuple[ContentURI, str, int]:
if not url:
raise ValueError('URL not provided')
async with aiohttp.ClientSession() as session:
resp = await session.get(url)
data = await resp.read()
......@@ -561,7 +563,8 @@ class Portal:
file_name=attachment.name,
relates_to=self._get_facebook_reply(reply_to))
elif isinstance(attachment, ImageAttachment):
mxc, mime, size = await self._reupload_fb_photo(attachment.large_preview_url, intent)
mxc, mime, size = await self._reupload_fb_photo(attachment.large_preview_url
or attachment.preview_url, intent)
info = ImageInfo(size=size, mimetype=mime,
width=attachment.large_preview_width,
height=attachment.large_preview_height)
......
......@@ -27,7 +27,7 @@ setuptools.setup(
"ruamel.yaml>=0.15.94,<0.17",
"commonmark>=0.8,<0.10",
"python-magic>=0.4,<0.5",
"fbchat-asyncio>=0.2.4,<0.3.0",
"fbchat-asyncio @ https://github.com/tulir/fbchat-asyncio/tarball/yet-another-rewrite",
"SQLAlchemy>=1.2,<2",
"alembic>=1,<2",
],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment