smart-bot-factory 0.3.6__py3-none-any.whl → 0.3.8__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/admin/__init__.py +7 -7
- smart_bot_factory/admin/admin_events.py +483 -383
- smart_bot_factory/admin/admin_logic.py +234 -158
- smart_bot_factory/admin/admin_manager.py +68 -53
- smart_bot_factory/admin/admin_tester.py +46 -40
- smart_bot_factory/admin/timeout_checker.py +201 -153
- smart_bot_factory/aiogram_calendar/__init__.py +11 -3
- smart_bot_factory/aiogram_calendar/common.py +12 -18
- smart_bot_factory/aiogram_calendar/dialog_calendar.py +126 -64
- smart_bot_factory/aiogram_calendar/schemas.py +49 -28
- smart_bot_factory/aiogram_calendar/simple_calendar.py +94 -50
- smart_bot_factory/analytics/analytics_manager.py +414 -392
- smart_bot_factory/cli.py +204 -148
- smart_bot_factory/config.py +123 -102
- smart_bot_factory/core/bot_utils.py +480 -324
- smart_bot_factory/core/conversation_manager.py +287 -200
- smart_bot_factory/core/decorators.py +1145 -739
- smart_bot_factory/core/message_sender.py +287 -266
- smart_bot_factory/core/router.py +170 -100
- smart_bot_factory/core/router_manager.py +121 -83
- smart_bot_factory/core/states.py +4 -3
- smart_bot_factory/creation/__init__.py +1 -1
- smart_bot_factory/creation/bot_builder.py +320 -242
- smart_bot_factory/creation/bot_testing.py +440 -365
- smart_bot_factory/dashboard/__init__.py +1 -3
- smart_bot_factory/event/__init__.py +2 -7
- smart_bot_factory/handlers/handlers.py +682 -466
- smart_bot_factory/integrations/openai_client.py +218 -168
- smart_bot_factory/integrations/supabase_client.py +928 -637
- smart_bot_factory/message/__init__.py +18 -22
- smart_bot_factory/router/__init__.py +2 -2
- smart_bot_factory/setup_checker.py +162 -126
- smart_bot_factory/supabase/__init__.py +1 -1
- smart_bot_factory/supabase/client.py +631 -515
- smart_bot_factory/utils/__init__.py +2 -3
- smart_bot_factory/utils/debug_routing.py +38 -27
- smart_bot_factory/utils/prompt_loader.py +153 -120
- smart_bot_factory/utils/user_prompt_loader.py +55 -56
- smart_bot_factory/utm_link_generator.py +123 -116
- {smart_bot_factory-0.3.6.dist-info → smart_bot_factory-0.3.8.dist-info}/METADATA +3 -1
- smart_bot_factory-0.3.8.dist-info/RECORD +59 -0
- smart_bot_factory-0.3.6.dist-info/RECORD +0 -59
- {smart_bot_factory-0.3.6.dist-info → smart_bot_factory-0.3.8.dist-info}/WHEEL +0 -0
- {smart_bot_factory-0.3.6.dist-info → smart_bot_factory-0.3.8.dist-info}/entry_points.txt +0 -0
- {smart_bot_factory-0.3.6.dist-info → smart_bot_factory-0.3.8.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,45 +2,41 @@
|
|
|
2
2
|
Message модули smart_bot_factory
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
send_message_by_ai,
|
|
9
|
-
send_message_to_users_by_stage,
|
|
10
|
-
send_message,
|
|
11
|
-
)
|
|
5
|
+
from ..core.message_sender import (send_message, send_message_by_ai,
|
|
6
|
+
send_message_by_human,
|
|
7
|
+
send_message_to_users_by_stage)
|
|
12
8
|
|
|
13
9
|
|
|
14
10
|
def get_bot():
|
|
15
11
|
"""
|
|
16
12
|
Получает aiogram Bot из глобального контекста
|
|
17
|
-
|
|
13
|
+
|
|
18
14
|
Доступен после вызова bot_builder.start()
|
|
19
|
-
|
|
15
|
+
|
|
20
16
|
Returns:
|
|
21
17
|
Bot: aiogram Bot объект
|
|
22
|
-
|
|
18
|
+
|
|
23
19
|
Raises:
|
|
24
20
|
RuntimeError: Если bot еще не инициализирован
|
|
25
|
-
|
|
21
|
+
|
|
26
22
|
Example:
|
|
27
23
|
from smart_bot_factory.message import get_bot
|
|
28
|
-
|
|
24
|
+
|
|
29
25
|
@event_router.event_handler("booking")
|
|
30
26
|
async def handle_booking(user_id: int, event_data: str):
|
|
31
27
|
bot = get_bot()
|
|
32
|
-
|
|
28
|
+
|
|
33
29
|
# Получаем информацию о пользователе из Telegram
|
|
34
30
|
telegram_user = await bot.get_chat(user_id)
|
|
35
31
|
name = telegram_user.first_name or 'Клиент'
|
|
36
|
-
|
|
32
|
+
|
|
37
33
|
# Используем любые методы aiogram Bot
|
|
38
34
|
await bot.send_message(user_id, f"Привет, {name}!")
|
|
39
35
|
await bot.send_photo(user_id, photo=...)
|
|
40
36
|
"""
|
|
41
37
|
from ..handlers.handlers import get_global_var
|
|
42
|
-
|
|
43
|
-
bot = get_global_var(
|
|
38
|
+
|
|
39
|
+
bot = get_global_var("bot")
|
|
44
40
|
if not bot:
|
|
45
41
|
raise RuntimeError(
|
|
46
42
|
"Bot еще не инициализирован. "
|
|
@@ -52,9 +48,9 @@ def get_bot():
|
|
|
52
48
|
|
|
53
49
|
|
|
54
50
|
__all__ = [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
]
|
|
51
|
+
"send_message_by_human",
|
|
52
|
+
"send_message_by_ai",
|
|
53
|
+
"send_message_to_users_by_stage",
|
|
54
|
+
"send_message", # Чистая отправка с файлами и кнопками
|
|
55
|
+
"get_bot", # Доступ к aiogram Bot
|
|
56
|
+
]
|