smart-bot-factory 0.2.8__py3-none-any.whl → 0.2.9__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.

@@ -10,9 +10,51 @@ from ..core.message_sender import (
10
10
  send_message,
11
11
  )
12
12
 
13
+
14
+ def get_bot():
15
+ """
16
+ Получает aiogram Bot из глобального контекста
17
+
18
+ Доступен после вызова bot_builder.start()
19
+
20
+ Returns:
21
+ Bot: aiogram Bot объект
22
+
23
+ Raises:
24
+ RuntimeError: Если bot еще не инициализирован
25
+
26
+ Example:
27
+ from smart_bot_factory.message import get_bot
28
+
29
+ @event_router.event_handler("booking")
30
+ async def handle_booking(user_id: int, event_data: str):
31
+ bot = get_bot()
32
+
33
+ # Получаем информацию о пользователе из Telegram
34
+ telegram_user = await bot.get_chat(user_id)
35
+ name = telegram_user.first_name or 'Клиент'
36
+
37
+ # Используем любые методы aiogram Bot
38
+ await bot.send_message(user_id, f"Привет, {name}!")
39
+ await bot.send_photo(user_id, photo=...)
40
+ """
41
+ from ..handlers.handlers import get_global_var
42
+
43
+ bot = get_global_var('bot')
44
+ if not bot:
45
+ raise RuntimeError(
46
+ "Bot еще не инициализирован. "
47
+ "Убедитесь что bot_builder.start() уже вызван. "
48
+ "Функция get_bot() доступна только внутри обработчиков событий, "
49
+ "которые выполняются во время работы бота."
50
+ )
51
+ return bot
52
+
53
+
13
54
  __all__ = [
14
55
  'send_message_by_human',
15
56
  'send_message_by_ai',
16
57
  'send_message_to_users_by_stage',
17
58
  'send_message', # Чистая отправка с файлами и кнопками
59
+ 'get_bot', # Доступ к aiogram Bot
18
60
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smart-bot-factory
3
- Version: 0.2.8
3
+ Version: 0.2.9
4
4
  Summary: Библиотека для создания умных чат-ботов
5
5
  Author-email: Kopatych <kopatych@example.com>
6
6
  License: MIT
@@ -39,7 +39,7 @@ smart_bot_factory/event/__init__.py,sha256=hPL449RULIOB-OXv1ZbGNiHctAYaOMUqhSWGP
39
39
  smart_bot_factory/handlers/handlers.py,sha256=tNtOjtdLUIXVh8mqjTD2kc2N_GiU69BYzxhcOJ2ozBI,41542
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
- smart_bot_factory/message/__init__.py,sha256=8XWEEl3J0l1xDeEPmXPwFbHbnQelGApCwnicUkcBbOg,391
42
+ smart_bot_factory/message/__init__.py,sha256=-ehDZweUc3uKgmLLxFVsD-KWrDtnHpHms7pCrDelWo0,1950
43
43
  smart_bot_factory/router/__init__.py,sha256=QrfO5u8H2uVzWGMtBvNKunsJAv7UrKtvt2f_D5xSFWE,270
44
44
  smart_bot_factory/supabase/__init__.py,sha256=XmZP6yM9ffERM5ddAWyJnrNzEhCYtMu3AcjVCi1rOf8,179
45
45
  smart_bot_factory/supabase/client.py,sha256=lWIzfOgoSvU7xPhYLoJtM5GnbWdoWsvHcRFC22sFBMU,25637
@@ -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.8.dist-info/METADATA,sha256=Qr7RQARKvkHX6G7Qh2Wt46FWhpAAsOkNrjPz15nS_UE,28224
53
- smart_bot_factory-0.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
54
- smart_bot_factory-0.2.8.dist-info/entry_points.txt,sha256=ybKEAI0WSb7WoRiey7QE-HHfn88UGV7nxLDxXq7b7SU,50
55
- smart_bot_factory-0.2.8.dist-info/licenses/LICENSE,sha256=OrK3cwdUTzNzIhJvSPtJaVMoYIyC_sSx5EFE_FDMvGs,1092
56
- smart_bot_factory-0.2.8.dist-info/RECORD,,
52
+ smart_bot_factory-0.2.9.dist-info/METADATA,sha256=hHilFtkAeolVCWusOfz5HKma8xu1VP3RmjkQnDgmYi0,28224
53
+ smart_bot_factory-0.2.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
54
+ smart_bot_factory-0.2.9.dist-info/entry_points.txt,sha256=ybKEAI0WSb7WoRiey7QE-HHfn88UGV7nxLDxXq7b7SU,50
55
+ smart_bot_factory-0.2.9.dist-info/licenses/LICENSE,sha256=OrK3cwdUTzNzIhJvSPtJaVMoYIyC_sSx5EFE_FDMvGs,1092
56
+ smart_bot_factory-0.2.9.dist-info/RECORD,,