From 0bb6fb77856b39bf99e104578f2455d6beb9fac5 Mon Sep 17 00:00:00 2001 From: iskomir Date: Sun, 21 Apr 2024 02:09:53 +0300 Subject: [PATCH 1/7] Update handlers.py --- src/handlers.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/handlers.py b/src/handlers.py index cdfb987..f7f2f5f 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -160,6 +160,15 @@ async def handler_print(update: Update, context: ContextTypes.DEFAULT_TYPE): ) logging.warning(f'{log_actor(update)} print api 413 SizeErr') return + + elif r.status_code == 415: + await update.message.reply_text( + text=ans.unreadable_file_error.format(update.message.document.file_name), + reply_to_message_id=update.message.id, + parse_mode=ParseMode('HTML'), + ) + logging.warning(f'{log_actor(update)} print api 415 UnreadableErr') + return await context.bot.send_message( chat_id=update.effective_user.id, text=ans.print_err, @@ -181,6 +190,13 @@ async def handler_other_messages(update: Update, context: ContextTypes.DEFAULT_T await update.message.reply_text(ans.err_message_type) +@errors_solver +@log_formatter +async def handler_other_messages(update: Update, context: ContextTypes.DEFAULT_TYPE): + await update.message.reply_text(ans.unreadable_file_error) + marketing.print_exc_format(tg_id=update.message.chat_id) + + @errors_solver @log_formatter async def handler_register(update: Update, context: ContextTypes.DEFAULT_TYPE): From ef3c9e9b13f8dcc4d22b8b7237f61a889e424ec2 Mon Sep 17 00:00:00 2001 From: iskomir Date: Sun, 21 Apr 2024 02:10:08 +0300 Subject: [PATCH 2/7] Update answers.py --- src/answers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/answers.py b/src/answers.py index 87d9aba..864f44b 100644 --- a/src/answers.py +++ b/src/answers.py @@ -68,6 +68,7 @@ class Answers: '{}\n\n' 'Для быстрой печати отсканируйте QR код на экране принтера.' ) + unreadable_file_error = '⚠️ Я не смог прочитать файл. Проверьте его целостность и формат, я работаю только с pdf.' qr_print = '{}{}' settings_warning = 'Настройки сохраняются автоматически.' settings_change_fail = 'Что-то сломалось, настройки печати не изменены, попробуйте через пару минут.' From 38fab965ddefb837c7ff1a411ac0693b35551458 Mon Sep 17 00:00:00 2001 From: iskomir Date: Sun, 21 Apr 2024 02:14:14 +0300 Subject: [PATCH 3/7] Update bd42bc6088a1_nullable.py --- migrations/versions/bd42bc6088a1_nullable.py | 1 + 1 file changed, 1 insertion(+) diff --git a/migrations/versions/bd42bc6088a1_nullable.py b/migrations/versions/bd42bc6088a1_nullable.py index 006b133..e77da55 100644 --- a/migrations/versions/bd42bc6088a1_nullable.py +++ b/migrations/versions/bd42bc6088a1_nullable.py @@ -5,6 +5,7 @@ Create Date: 2023-02-22 21:18:53.212500 """ + import sqlalchemy as sa from alembic import op From 289b1ffd5ffb27cefb0166a43e5ed401eb4c6bff Mon Sep 17 00:00:00 2001 From: iskomir Date: Sun, 21 Apr 2024 02:14:17 +0300 Subject: [PATCH 4/7] Update 56584d8792af_init.py --- migrations/versions/56584d8792af_init.py | 1 + 1 file changed, 1 insertion(+) diff --git a/migrations/versions/56584d8792af_init.py b/migrations/versions/56584d8792af_init.py index 6c64c84..4634c87 100644 --- a/migrations/versions/56584d8792af_init.py +++ b/migrations/versions/56584d8792af_init.py @@ -5,6 +5,7 @@ Create Date: 2023-01-12 18:59:05.426265 """ + import sqlalchemy as sa from alembic import op From 7e13a7ab7af8a3d452feaff5fc82fa134524b311 Mon Sep 17 00:00:00 2001 From: iskomir Date: Sun, 21 Apr 2024 02:14:19 +0300 Subject: [PATCH 5/7] Update 14de3a5684ea_bigint.py --- migrations/versions/14de3a5684ea_bigint.py | 1 + 1 file changed, 1 insertion(+) diff --git a/migrations/versions/14de3a5684ea_bigint.py b/migrations/versions/14de3a5684ea_bigint.py index 90a440a..2277f0f 100644 --- a/migrations/versions/14de3a5684ea_bigint.py +++ b/migrations/versions/14de3a5684ea_bigint.py @@ -5,6 +5,7 @@ Create Date: 2023-02-22 21:30:21.156049 """ + import sqlalchemy as sa from alembic import op From fcbae9a102ad32a68908fc070dfdf4a1a29b2eb1 Mon Sep 17 00:00:00 2001 From: iskomir Date: Sun, 21 Apr 2024 12:54:27 +0300 Subject: [PATCH 6/7] Update answers.py --- src/answers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/answers.py b/src/answers.py index 864f44b..09f39ca 100644 --- a/src/answers.py +++ b/src/answers.py @@ -68,7 +68,7 @@ class Answers: '{}\n\n' 'Для быстрой печати отсканируйте QR код на экране принтера.' ) - unreadable_file_error = '⚠️ Я не смог прочитать файл. Проверьте его целостность и формат, я работаю только с pdf.' + unreadable_file_error = '⚠️ Я не смог прочитать файл {}. Проверьте его целостность и формат, я работаю только с pdf.' qr_print = '{}{}' settings_warning = 'Настройки сохраняются автоматически.' settings_change_fail = 'Что-то сломалось, настройки печати не изменены, попробуйте через пару минут.' From b5b1bdcfbb71b705626acc299b9357acb68679ef Mon Sep 17 00:00:00 2001 From: iskomir Date: Sun, 21 Apr 2024 12:54:35 +0300 Subject: [PATCH 7/7] Update handlers.py --- src/handlers.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/handlers.py b/src/handlers.py index f7f2f5f..e94351b 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -190,13 +190,6 @@ async def handler_other_messages(update: Update, context: ContextTypes.DEFAULT_T await update.message.reply_text(ans.err_message_type) -@errors_solver -@log_formatter -async def handler_other_messages(update: Update, context: ContextTypes.DEFAULT_TYPE): - await update.message.reply_text(ans.unreadable_file_error) - marketing.print_exc_format(tg_id=update.message.chat_id) - - @errors_solver @log_formatter async def handler_register(update: Update, context: ContextTypes.DEFAULT_TYPE):