Fix save_file in case client.me is None

This commit is contained in:
KurimuzonAkuma 2024-08-27 11:37:13 +03:00
parent 1d92c09d44
commit 00d1b532b8

View File

@ -128,7 +128,10 @@ class SaveFile:
if file_size == 0:
raise ValueError("File size equals to 0 B")
file_size_limit_mib = 4000 if self.me.is_premium else 2000
if self.me and self.me.is_premium:
file_size_limit_mib = 4000
else:
file_size_limit_mib = 2000
if file_size > file_size_limit_mib * 1024 * 1024:
raise ValueError(f"Can't upload files bigger than {file_size_limit_mib} MiB")