smart-bot-factory 0.1.3__py3-none-any.whl → 0.1.4__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/__init__.py +1 -19
- smart_bot_factory/cli.py +168 -42
- smart_bot_factory/core/bot_utils.py +22 -12
- smart_bot_factory/core/decorators.py +61 -60
- smart_bot_factory/utm_link_generator.py +106 -0
- {smart_bot_factory-0.1.3.dist-info → smart_bot_factory-0.1.4.dist-info}/METADATA +1 -1
- {smart_bot_factory-0.1.3.dist-info → smart_bot_factory-0.1.4.dist-info}/RECORD +10 -10
- smart_bot_factory/uv.lock +0 -2004
- {smart_bot_factory-0.1.3.dist-info → smart_bot_factory-0.1.4.dist-info}/WHEEL +0 -0
- {smart_bot_factory-0.1.3.dist-info → smart_bot_factory-0.1.4.dist-info}/entry_points.txt +0 -0
- {smart_bot_factory-0.1.3.dist-info → smart_bot_factory-0.1.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Генератор UTM-ссылок для Telegram ботов
|
|
4
|
+
Создает ссылки в формате: @https://t.me/bot?start=source-vk_campaign-summer2025
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
def get_user_input():
|
|
8
|
+
"""Получает данные от пользователя через консоль"""
|
|
9
|
+
print("🔗 Генератор UTM-ссылок для Telegram")
|
|
10
|
+
print("=" * 50)
|
|
11
|
+
|
|
12
|
+
# Основные параметры
|
|
13
|
+
bot_username = input("Введите username бота (без @): ").strip()
|
|
14
|
+
if not bot_username:
|
|
15
|
+
print("❌ Username бота обязателен!")
|
|
16
|
+
return None
|
|
17
|
+
|
|
18
|
+
print("\n📊 Введите UTM-метки (нажмите Enter для пропуска):")
|
|
19
|
+
|
|
20
|
+
# UTM параметры (соответствуют полям в базе данных)
|
|
21
|
+
utm_source = input("utm_source (источник): ").strip()
|
|
22
|
+
utm_medium = input("utm_medium (канал): ").strip()
|
|
23
|
+
utm_campaign = input("utm_campaign (кампания): ").strip()
|
|
24
|
+
utm_content = input("utm_content (контент): ").strip()
|
|
25
|
+
utm_term = input("utm_term (ключевое слово): ").strip()
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
'bot_username': bot_username,
|
|
29
|
+
'utm_source': utm_source,
|
|
30
|
+
'utm_medium': utm_medium,
|
|
31
|
+
'utm_campaign': utm_campaign,
|
|
32
|
+
'utm_content': utm_content,
|
|
33
|
+
'utm_term': utm_term
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def create_utm_string(utm_data):
|
|
37
|
+
"""Создает строку UTM параметров в формате source-vk_campaign-summer2025"""
|
|
38
|
+
utm_parts = []
|
|
39
|
+
|
|
40
|
+
# Маппинг полей базы данных на новый формат (без utm, в нижнем регистре)
|
|
41
|
+
field_mapping = {
|
|
42
|
+
'utm_source': 'source',
|
|
43
|
+
'utm_medium': 'medium',
|
|
44
|
+
'utm_campaign': 'campaign',
|
|
45
|
+
'utm_content': 'content',
|
|
46
|
+
'utm_term': 'term'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
for db_field, utm_field in field_mapping.items():
|
|
50
|
+
value = utm_data.get(db_field)
|
|
51
|
+
if value:
|
|
52
|
+
utm_parts.append(f"{utm_field}-{value}")
|
|
53
|
+
|
|
54
|
+
return "_".join(utm_parts)
|
|
55
|
+
|
|
56
|
+
def generate_telegram_link(bot_username, utm_string):
|
|
57
|
+
"""Генерирует полную ссылку на Telegram бота"""
|
|
58
|
+
return f"https://t.me/{bot_username}?start={utm_string}"
|
|
59
|
+
|
|
60
|
+
def check_size_and_validate(utm_string):
|
|
61
|
+
"""Проверяет размер строки после start= и валидирует"""
|
|
62
|
+
MAX_SIZE = 64
|
|
63
|
+
|
|
64
|
+
if len(utm_string) > MAX_SIZE:
|
|
65
|
+
return False, f"Строка слишком большая: {len(utm_string)} символов (максимум {MAX_SIZE})"
|
|
66
|
+
|
|
67
|
+
return True, f"Размер OK: {len(utm_string)} символов"
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def main():
|
|
71
|
+
"""Основная функция"""
|
|
72
|
+
try:
|
|
73
|
+
# Получаем данные от пользователя
|
|
74
|
+
data = get_user_input()
|
|
75
|
+
if not data:
|
|
76
|
+
return
|
|
77
|
+
|
|
78
|
+
# Создаем UTM строку
|
|
79
|
+
utm_string = create_utm_string(data)
|
|
80
|
+
|
|
81
|
+
if not utm_string:
|
|
82
|
+
print("❌ Не указано ни одной UTM-метки!")
|
|
83
|
+
return
|
|
84
|
+
|
|
85
|
+
# Проверяем размер
|
|
86
|
+
is_valid, size_message = check_size_and_validate(utm_string)
|
|
87
|
+
|
|
88
|
+
print(f"\n📏 {size_message}")
|
|
89
|
+
|
|
90
|
+
if not is_valid:
|
|
91
|
+
print("❌ Ссылка превышает максимальный размер!")
|
|
92
|
+
print("💡 Сократите значения UTM-меток или уберите менее важные")
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
# Генерируем и выводим ссылку
|
|
96
|
+
telegram_link = generate_telegram_link(data['bot_username'], utm_string)
|
|
97
|
+
|
|
98
|
+
print(f"\n✅ Сгенерированная ссылка:")
|
|
99
|
+
print(f"🔗 {telegram_link}")
|
|
100
|
+
except KeyboardInterrupt:
|
|
101
|
+
print("\n\n👋 Отменено пользователем")
|
|
102
|
+
except Exception as e:
|
|
103
|
+
print(f"\n❌ Ошибка: {e}")
|
|
104
|
+
|
|
105
|
+
if __name__ == "__main__":
|
|
106
|
+
main()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
smart_bot_factory/__init__.py,sha256=
|
|
2
|
-
smart_bot_factory/cli.py,sha256=
|
|
1
|
+
smart_bot_factory/__init__.py,sha256=hEBETppVeFGwOqi_V7wos9oMathdRDVbRBrPmaf9uZ0,1304
|
|
2
|
+
smart_bot_factory/cli.py,sha256=10kLLiVx0MFQJZ5yXp0yV5d0vZYKIbhzEMmKJ3KyoUg,32998
|
|
3
3
|
smart_bot_factory/config.py,sha256=kB3G2hGMrrCSOAvlrddf8x43bgfgEaQqOCKOeELAzfM,11640
|
|
4
4
|
smart_bot_factory/setup_checker.py,sha256=fqRzyptyMzcb2I0boUaj0rWLdarqaN6ViX6suwTEeWc,20123
|
|
5
|
-
smart_bot_factory/
|
|
5
|
+
smart_bot_factory/utm_link_generator.py,sha256=jw7c84Y_ZvLpV4jaBWw0GK3-lCUKIIa8sZ8YNxoWIlc,4166
|
|
6
6
|
smart_bot_factory/admin/__init__.py,sha256=aA8VMXkFn7TiWAMeHzkXCPFGEPxJvL2ECdFASSr7jtU,397
|
|
7
7
|
smart_bot_factory/admin/admin_logic.py,sha256=K41UKpeUWwL9vTq9e-OCwoMZxVsOCOOPR5l9SVspGhI,20616
|
|
8
8
|
smart_bot_factory/admin/admin_manager.py,sha256=xlyG9mIjPmtUhS4E9lp36T7o5Kfp5PZpJ-r1QjnSn5g,6394
|
|
@@ -35,9 +35,9 @@ smart_bot_factory/configs/growthmed-october-24/tests/scenario_examples.yaml,sha2
|
|
|
35
35
|
smart_bot_factory/configs/growthmed-october-24/welcome_file/welcome_file_msg.txt,sha256=Db21Mm0r8SBWFdX9EeIF2FZtLQ2cvuwVlSRJd2KEYCg,922
|
|
36
36
|
smart_bot_factory/configs/growthmed-october-24/welcome_file/Чек лист по 152ФЗ и 323ФЗ для медицины.pdf,sha256=BiAiQHNnQXJPMsks9AeL6s0beEjRFkRMJLMlAn4WorA,5284954
|
|
37
37
|
smart_bot_factory/core/__init__.py,sha256=Q0MNoUR5zKMPcE4ge9kgS1cRnQfJ-RN8c_cd7kZufTo,648
|
|
38
|
-
smart_bot_factory/core/bot_utils.py,sha256
|
|
38
|
+
smart_bot_factory/core/bot_utils.py,sha256=Z76AC8CMPxtmk3ooLvuL-ZsfLeHITDdFN2sV0RzVA1g,32676
|
|
39
39
|
smart_bot_factory/core/conversation_manager.py,sha256=L_yj4VfQ0_oblBqczVZfeZ9g6gkJ5XmhdsLSz2vtfbs,27307
|
|
40
|
-
smart_bot_factory/core/decorators.py,sha256=
|
|
40
|
+
smart_bot_factory/core/decorators.py,sha256=Be7sP_BkijaKMZrQOZt5IlVYw8AcHTrwP_rvX0nMw7Y,10291
|
|
41
41
|
smart_bot_factory/core/message_sender.py,sha256=ukfxtnuqLU2vTT-W0yr5rSigq8Ym2rIZeQntlEB5i6U,10067
|
|
42
42
|
smart_bot_factory/core/states.py,sha256=AOc19_yAsDW_8md-2oiowjBhuW3bwcsmMxszCXWZZTQ,355
|
|
43
43
|
smart_bot_factory/creation/__init__.py,sha256=QsKcT7e5UKv5-9PaNiMo2G5Pv2iYF83OElFo8Zj_xuI,209
|
|
@@ -52,8 +52,8 @@ smart_bot_factory/integrations/supabase_client.py,sha256=8vT5RR12JJJfGFldAx9uUa-
|
|
|
52
52
|
smart_bot_factory/utils/__init__.py,sha256=5zNjw491bj5VkOhoEAwh2hjmv8nldyDOTrG7pbGpz6A,285
|
|
53
53
|
smart_bot_factory/utils/debug_routing.py,sha256=BOoDhKBg7UXe5uHQxRk3TSfPfLPOFqt0N7lAo6kjCOo,4719
|
|
54
54
|
smart_bot_factory/utils/prompt_loader.py,sha256=JSn7CsWnToSbHYtURdeuZn7ectyDqQGrPGHN2ixIGkw,19930
|
|
55
|
-
smart_bot_factory-0.1.
|
|
56
|
-
smart_bot_factory-0.1.
|
|
57
|
-
smart_bot_factory-0.1.
|
|
58
|
-
smart_bot_factory-0.1.
|
|
59
|
-
smart_bot_factory-0.1.
|
|
55
|
+
smart_bot_factory-0.1.4.dist-info/METADATA,sha256=MsGdj-lY1pYP32u0T4TIN9LtN46dNDdQKRHdW3Ls5ck,3528
|
|
56
|
+
smart_bot_factory-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
57
|
+
smart_bot_factory-0.1.4.dist-info/entry_points.txt,sha256=ybKEAI0WSb7WoRiey7QE-HHfn88UGV7nxLDxXq7b7SU,50
|
|
58
|
+
smart_bot_factory-0.1.4.dist-info/licenses/LICENSE,sha256=OrK3cwdUTzNzIhJvSPtJaVMoYIyC_sSx5EFE_FDMvGs,1092
|
|
59
|
+
smart_bot_factory-0.1.4.dist-info/RECORD,,
|