smart-bot-factory 0.2.10__py3-none-any.whl → 0.2.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of smart-bot-factory might be problematic. Click here for more details.
- smart_bot_factory/creation/bot_builder.py +11 -5
- smart_bot_factory/handlers/handlers.py +3 -2
- {smart_bot_factory-0.2.10.dist-info → smart_bot_factory-0.2.11.dist-info}/METADATA +1 -1
- {smart_bot_factory-0.2.10.dist-info → smart_bot_factory-0.2.11.dist-info}/RECORD +7 -7
- {smart_bot_factory-0.2.10.dist-info → smart_bot_factory-0.2.11.dist-info}/WHEEL +0 -0
- {smart_bot_factory-0.2.10.dist-info → smart_bot_factory-0.2.11.dist-info}/entry_points.txt +0 -0
- {smart_bot_factory-0.2.10.dist-info → smart_bot_factory-0.2.11.dist-info}/licenses/LICENSE +0 -0
|
@@ -542,17 +542,23 @@ class BotBuilder:
|
|
|
542
542
|
"""
|
|
543
543
|
Регистрирует фильтр отправки (может блокировать отправку пользователю)
|
|
544
544
|
|
|
545
|
-
Если фильтр возвращает
|
|
545
|
+
Если фильтр возвращает True, сообщение НЕ отправляется
|
|
546
546
|
|
|
547
547
|
Args:
|
|
548
|
-
handler: async def(user_id: int
|
|
548
|
+
handler: async def(user_id: int) -> bool
|
|
549
549
|
|
|
550
550
|
Example:
|
|
551
551
|
@bot_builder.filter_send
|
|
552
|
-
async def block_during_process(user_id
|
|
552
|
+
async def block_during_process(user_id):
|
|
553
553
|
if is_processing(user_id):
|
|
554
|
-
return
|
|
555
|
-
return
|
|
554
|
+
return True # Блокируем отправку
|
|
555
|
+
return False # Разрешаем отправку
|
|
556
|
+
|
|
557
|
+
# Или совместимый с should_block_ai_response
|
|
558
|
+
@bot_builder.filter_send
|
|
559
|
+
async def should_block_ai_response(user_id):
|
|
560
|
+
# Ваша логика проверки
|
|
561
|
+
return user_is_blocked(user_id) # True = блокировать
|
|
556
562
|
"""
|
|
557
563
|
if not callable(handler):
|
|
558
564
|
raise TypeError(f"Обработчик должен быть callable, получен {type(handler)}")
|
|
@@ -753,8 +753,9 @@ async def process_user_message(message: Message, state: FSMContext, session_id:
|
|
|
753
753
|
for filter_func in send_filters:
|
|
754
754
|
try:
|
|
755
755
|
should_send = await filter_func(message.from_user.id)
|
|
756
|
-
if
|
|
757
|
-
|
|
756
|
+
if should_send:
|
|
757
|
+
# True = блокируем (для совместимости с should_block_ai_response)
|
|
758
|
+
logger.info(f"⛔ Фильтр '{filter_func.__name__}' заблокировал отправку (вернул True)")
|
|
758
759
|
return # Не отправляем
|
|
759
760
|
except Exception as e:
|
|
760
761
|
logger.error(f"❌ Ошибка в фильтре отправки '{filter_func.__name__}': {e}")
|
|
@@ -33,10 +33,10 @@ smart_bot_factory/core/router_manager.py,sha256=dUwesog-oHk1U2EDdS8p0e4MTSkwtx5_
|
|
|
33
33
|
smart_bot_factory/core/states.py,sha256=AOc19_yAsDW_8md-2oiowjBhuW3bwcsmMxszCXWZZTQ,355
|
|
34
34
|
smart_bot_factory/core/telegram_router.py,sha256=LcPLOd87Y4Y4YN6TBXVAtmpSp8gAK2otgMI4YS5f5tk,2091
|
|
35
35
|
smart_bot_factory/creation/__init__.py,sha256=IgDk8GDS3pg7Pw_Et41J33ZmeZIU5dRwQdTmYKXfJfE,128
|
|
36
|
-
smart_bot_factory/creation/bot_builder.py,sha256=
|
|
36
|
+
smart_bot_factory/creation/bot_builder.py,sha256=Yl5s21DdnLWqfj8mvDI9IfC_XfLxdFhCl9E_rDHKS78,38285
|
|
37
37
|
smart_bot_factory/creation/bot_testing.py,sha256=JDWXyJfZmbgo-DLdAPk8Sd9FiehtHHa4sLD17lBrTOc,55669
|
|
38
38
|
smart_bot_factory/event/__init__.py,sha256=hPL449RULIOB-OXv1ZbGNiHctAYaOMUqhSWGPrDHYBM,212
|
|
39
|
-
smart_bot_factory/handlers/handlers.py,sha256=
|
|
39
|
+
smart_bot_factory/handlers/handlers.py,sha256=mR_07F6CaKri7TmUByx3a2pxK_JDbpBE_apOSOFjq3U,41670
|
|
40
40
|
smart_bot_factory/integrations/openai_client.py,sha256=aMcDrKO0GEx3ZSVEOGDeDtFCDWSXs6biUfgrbRK8yTU,23180
|
|
41
41
|
smart_bot_factory/integrations/supabase_client.py,sha256=AfALLZdDYeMWHLJw6POTGiBd-sH3i03oT6tT7m9C28I,44644
|
|
42
42
|
smart_bot_factory/message/__init__.py,sha256=-ehDZweUc3uKgmLLxFVsD-KWrDtnHpHms7pCrDelWo0,1950
|
|
@@ -49,8 +49,8 @@ smart_bot_factory/utils/__init__.py,sha256=UhsJXEHfrIK8h1AHsroHSwAriijk-LvnqLyvg
|
|
|
49
49
|
smart_bot_factory/utils/debug_routing.py,sha256=BOoDhKBg7UXe5uHQxRk3TSfPfLPOFqt0N7lAo6kjCOo,4719
|
|
50
50
|
smart_bot_factory/utils/prompt_loader.py,sha256=JSn7CsWnToSbHYtURdeuZn7ectyDqQGrPGHN2ixIGkw,19930
|
|
51
51
|
smart_bot_factory/utils/user_prompt_loader.py,sha256=dk6P0X_3UcNqxjRtuIvb0LcPrp03zIIsstZwdmeCPaE,2519
|
|
52
|
-
smart_bot_factory-0.2.
|
|
53
|
-
smart_bot_factory-0.2.
|
|
54
|
-
smart_bot_factory-0.2.
|
|
55
|
-
smart_bot_factory-0.2.
|
|
56
|
-
smart_bot_factory-0.2.
|
|
52
|
+
smart_bot_factory-0.2.11.dist-info/METADATA,sha256=-x5rH6cqF0rrD5gWYXJU5VxrnsHwTWMFQzstlPVKXTc,28225
|
|
53
|
+
smart_bot_factory-0.2.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
54
|
+
smart_bot_factory-0.2.11.dist-info/entry_points.txt,sha256=ybKEAI0WSb7WoRiey7QE-HHfn88UGV7nxLDxXq7b7SU,50
|
|
55
|
+
smart_bot_factory-0.2.11.dist-info/licenses/LICENSE,sha256=OrK3cwdUTzNzIhJvSPtJaVMoYIyC_sSx5EFE_FDMvGs,1092
|
|
56
|
+
smart_bot_factory-0.2.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|