From 6b18ab01fa8bd9f906940d459192871701d967e4 Mon Sep 17 00:00:00 2001 From: Tr1zel Date: Thu, 13 Feb 2025 22:14:09 +0300 Subject: [PATCH 1/2] =?UTF-8?q?bug:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=20=D0=BD=D0=B5=D0=B2=D0=BE=D0=B7=D0=BC?= =?UTF-8?q?=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B8=20=D0=BB=D1=8E=D0=B1=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=82=D0=B8=D0=BF=D0=B0=20=D1=81=D0=BE=D0=BE?= =?UTF-8?q?=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=BA=D1=80=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=20=D1=82=D0=B5=D0=BA=D1=81=D1=82=D0=BE=D0=B2=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bug: добавлено сообщение (пока без текста от @miswetdy) о невозможности обработки любого типа сообщения кроме текстового. Так же исправлен .env-example --- .env.example | 2 +- core/handlers/student.py | 21 ++++++++++++++++++++- core/texts/errors.py | 3 +++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 62e2ac5..37e0c71 100644 --- a/.env.example +++ b/.env.example @@ -3,7 +3,7 @@ TELEGRAM_BOT_TOKEN = CHANNEL_CHAT_ID = COMMENT_CHAT_ID = -DB_HOST = localhost +DB_HOST = bmstu-direct-db DB_PORT = 5432 DB_NAME = postgres DB_USER = postgres diff --git a/core/handlers/student.py b/core/handlers/student.py index 7cc299c..4323eff 100644 --- a/core/handlers/student.py +++ b/core/handlers/student.py @@ -3,7 +3,7 @@ from aiogram.dispatcher import FSMContext from aiogram.dispatcher.filters import ChatTypeFilter, IsReplyFilter -from aiogram.types import Message, ReplyKeyboardRemove, ParseMode, ChatType +from aiogram.types import Message, ReplyKeyboardRemove, ParseMode, ChatType, ContentType from core import texts from core import states @@ -49,6 +49,25 @@ async def send_create_ticket(message: Message): ) await states.Registration.create_ticket.set() +@dp.message_handler(content_types=[ + ContentType.AUDIO, + ContentType.DOCUMENT, + ContentType.PHOTO, + ContentType.STICKER, + ContentType.VIDEO, + ContentType.VOICE, + ContentType.LOCATION, + ContentType.CONTACT, + ContentType.POLL, + ContentType.DICE, + ContentType.VIDEO_NOTE, + ContentType.ANIMATION, #GIF + ], state="*") +async def handle_no_text(message:Message): + await message.answer( + texts.errors.message_no_text, + parse_mode=ParseMode.HTML + ) @dp.message_handler(ChatTypeFilter(ChatType.PRIVATE), IsReplyFilter(is_reply=True), state="*") async def handle_student_answer(message: Message, store: Storage): diff --git a/core/texts/errors.py b/core/texts/errors.py index 3126cb6..ee2c7ca 100644 --- a/core/texts/errors.py +++ b/core/texts/errors.py @@ -18,3 +18,6 @@ unknown = \ "Мы не понимаем, что вы хотите сделать :(" + +message_no_text = \ + "Данный тип сообщение не поддерживается, введите пожалуйста текст!" From bbec1c290c3e6a5ddb7b25a44f133d8e896304e3 Mon Sep 17 00:00:00 2001 From: Tr1zel Date: Tue, 18 Feb 2025 12:10:09 +0300 Subject: [PATCH 2/2] =?UTF-8?q?bug:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BE=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA=D0=B8?= =?UTF-8?q?=20=20=D0=B4=D1=80=D1=83=D0=B3=D0=B8=D1=85=20=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B0=D1=82=D0=BE=D0=B2=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавлена папка /volume в .gitignore Добавлена ошибка о поддержки всего кроме текста. --- .gitignore | 2 ++ core/texts/errors.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7b6caf3..ca6679b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ __pycache__/ # C extensions *.so +/volume + # Distribution / packaging .Python build/ diff --git a/core/texts/errors.py b/core/texts/errors.py index ee2c7ca..f06d7c7 100644 --- a/core/texts/errors.py +++ b/core/texts/errors.py @@ -20,4 +20,4 @@ "Мы не понимаем, что вы хотите сделать :(" message_no_text = \ - "Данный тип сообщение не поддерживается, введите пожалуйста текст!" + "В данный момент BMSTU Direct поддерживает только текстовый формат сообщений. Отправка фото, видео и других файлов пока недоступна"