Skip to content

Commit

Permalink
Fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Mar 25, 2024
1 parent 637534c commit aed4f6a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mautrix_telegram/portal_util/message_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,14 @@ async def convert(
)
return converted

def _should_convert_full_document(self, document, is_bot: bool, is_channel: bool) -> bool:
if not isinstance(document, MessageMediaDocument):
def _should_convert_full_document(self, media, is_bot: bool, is_channel: bool) -> bool:
if not isinstance(media, MessageMediaDocument):
return True
size = media.document.size
if is_bot and self.config["bridge.document_as_link_size.bot"]:
return document.size < self.config["bridge.document_as_link_size.bot"] * 1000**2
return size < self.config["bridge.document_as_link_size.bot"] * 1000**2
if is_channel and self.config["bridge.document_as_link_size.channel"]:
return document.size < self.config["bridge.document_as_link_size.channel"] * 1000**2
return size < self.config["bridge.document_as_link_size.channel"] * 1000**2
return True

@staticmethod
Expand Down

0 comments on commit aed4f6a

Please sign in to comment.