This commit is contained in:
2023-05-06 22:16:28 +02:00
parent 185420ea3d
commit e102ad73f3
3 changed files with 90 additions and 108 deletions

View File

@@ -1,6 +1,5 @@
from typing import AsyncIterator, Optional, Union
import sentry_sdk
import telethon.client
import telethon.errors
import telethon.hints
@@ -27,13 +26,11 @@ class BaseStorage:
) -> Optional[tuple[Union[str, int], int]]:
try:
message = await self.client.send_file(
self.channel_id, file=file, caption=caption
entity=self.channel_id, file=file, caption=caption
)
except telethon.errors.FilePartInvalidError as e:
sentry_sdk.capture_exception(e)
except telethon.errors.FilePartInvalidError:
return None
except telethon.errors.PhotoInvalidError as e:
sentry_sdk.capture_exception(e)
except telethon.errors.PhotoInvalidError:
return None
if not message.media: