diff --git a/config.json b/config.json index 9c0af27..3bb12ba 100644 --- a/config.json +++ b/config.json @@ -64,7 +64,7 @@ }, "submission": { "timeout": 30, - "file_size": 5242880, + "file_size": 15728640, "mime_types": [ "image/png", "image/gif", diff --git a/locale/en.json b/locale/en.json index 7a3e5ca..a39f2f4 100644 --- a/locale/en.json +++ b/locale/en.json @@ -18,6 +18,7 @@ "sub_by": "\n\nSubmitted by:", "sub_sent": "Media has been submitted.\nWe'll notify you whether it will be accepted or not soon.", "sub_cooldown": "You can only submit 1 media per {0} seconds", + "document_too_large": "File you've sent is too large. Please submit files not bigger than {0} MB", "mime_not_allowed": "File type not allowed. Please, consider using one of these: {0}", "post_exception": "Could not send content due to `{exp}`\n\nTraceback:\n```{0}```", "post_empty": "Could not send content: `Queue folder is empty or contains only unsupported or already sent files.`" diff --git a/locale/uk.json b/locale/uk.json index 53645ba..11ba523 100644 --- a/locale/uk.json +++ b/locale/uk.json @@ -18,6 +18,7 @@ "sub_by": "\n\nПредставлено:", "sub_sent": "Медіа-файл надіслано.\nСкоро ми повідомимо вас, чи буде його прийнято.", "sub_cooldown": "Ви можете надсилати лише 1 медіафайл на {0} секунд", + "document_too_large": "Надісланий файл завеликий. Будь ласка, надсилайте файли не більше {0} Мб", "mime_not_allowed": "Тип файлу не дозволений. Розгляньте можливість використання одного з цих: {0}", "post_exception": "Не вдалося надіслати контент через `{exp}`\n\nTraceback:\n```{0}```", "post_empty": "Не вдалося надіслати контент: «Папка черги порожня або містить лише непідтримувані або вже надіслані файли»." diff --git a/main.py b/main.py index 9d8d20b..6418f42 100644 --- a/main.py +++ b/main.py @@ -226,6 +226,14 @@ def get_submission(_, msg): if msg.document.mime_type not in configGet("mime_types", "submission"): msg.reply_text(locale("mime_not_allowed", "message", locale=user_locale), quote=True) return + if msg.document.file_size > configGet("file_size", "submission"): + msg.reply_text(locale("document_too_large", "message", locale=user_locale).format(str(configGet("file_size", "submission")/1024/1024)), quote=True) + return + + if msg.video != None: + if msg.video.file_size > configGet("file_size", "submission"): + msg.reply_text(locale("document_too_large", "message", locale=user_locale).format(str(configGet("file_size", "submission")/1024/1024)), quote=True) + return buttons = [ [