multibotkit 0.1.34__py3-none-any.whl → 0.2.0__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.
- multibotkit/dispatchers/yandexmessenger.py +87 -0
- multibotkit/helpers/fb.py +4 -4
- multibotkit/helpers/telegram.py +84 -83
- multibotkit/helpers/viber.py +4 -4
- multibotkit/helpers/vk.py +2 -2
- multibotkit/helpers/yandexmessenger.py +408 -0
- multibotkit/schemas/telegram/incoming.py +13 -17
- multibotkit/schemas/yandexmessenger/__init__.py +0 -0
- multibotkit/schemas/yandexmessenger/incoming.py +77 -0
- multibotkit/schemas/yandexmessenger/outgoing.py +126 -0
- {multibotkit-0.1.34.dist-info → multibotkit-0.2.0.dist-info}/METADATA +19 -8
- {multibotkit-0.1.34.dist-info → multibotkit-0.2.0.dist-info}/RECORD +15 -10
- {multibotkit-0.1.34.dist-info → multibotkit-0.2.0.dist-info}/WHEEL +1 -1
- {multibotkit-0.1.34.dist-info → multibotkit-0.2.0.dist-info/licenses}/LICENSE +0 -0
- {multibotkit-0.1.34.dist-info → multibotkit-0.2.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
from typing import List, Optional, Union
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field, field_validator, model_validator
|
|
4
|
+
|
|
5
|
+
from multibotkit.schemas.yandexmessenger.incoming import Update
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class InlineKeyboardButton(BaseModel):
|
|
9
|
+
"""Кнопка inline клавиатуры"""
|
|
10
|
+
|
|
11
|
+
text: str = Field(..., title="Текст кнопки")
|
|
12
|
+
callback_data: Optional[Union[str, dict]] = Field(
|
|
13
|
+
None, title="JSON данные для callback (автоматически сериализуется)"
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class InlineKeyboard(BaseModel):
|
|
18
|
+
"""
|
|
19
|
+
Inline клавиатура (до 100 кнопок общего).
|
|
20
|
+
Структура: массив рядов, каждый ряд - массив кнопок.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
buttons: List[InlineKeyboardButton] = Field(..., title="Массив кнопок")
|
|
24
|
+
|
|
25
|
+
@field_validator("buttons")
|
|
26
|
+
@classmethod
|
|
27
|
+
def validate_button_count(cls, v: list) -> list:
|
|
28
|
+
"""Проверка лимита в 100 кнопок"""
|
|
29
|
+
total_buttons = len(v)
|
|
30
|
+
if total_buttons > 100:
|
|
31
|
+
raise ValueError("Максимум 100 кнопок в клавиатуре")
|
|
32
|
+
return v
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class SendTextParams(BaseModel):
|
|
36
|
+
"""Параметры для метода sendText"""
|
|
37
|
+
|
|
38
|
+
text: str = Field(..., title="Текст сообщения", max_length=6000)
|
|
39
|
+
chat_id: Optional[str] = Field(None, title="ID чата (для групповых чатов)")
|
|
40
|
+
login: Optional[str] = Field(None, title="Login пользователя (для приватных чатов)")
|
|
41
|
+
payload_id: Optional[str] = Field(
|
|
42
|
+
None, title="Уникальный ID для дедупликации (рекомендуется для webhook)"
|
|
43
|
+
)
|
|
44
|
+
reply_message_id: Optional[int] = Field(None, title="ID сообщения для ответа")
|
|
45
|
+
disable_notification: Optional[bool] = Field(None, title="Отключить уведомление")
|
|
46
|
+
important: Optional[bool] = Field(None, title="Отметить сообщение как важное")
|
|
47
|
+
disable_web_page_preview: Optional[bool] = Field(
|
|
48
|
+
None, title="Отключить превью веб-страниц"
|
|
49
|
+
)
|
|
50
|
+
thread_id: Optional[int] = Field(None, title="ID треда для ответа в треде")
|
|
51
|
+
inline_keyboard: Optional[InlineKeyboard] = Field(None, title="Inline клавиатура")
|
|
52
|
+
|
|
53
|
+
@model_validator(mode="after")
|
|
54
|
+
def validate_chat_or_login(self):
|
|
55
|
+
"""Проверка что указан либо chat_id либо login"""
|
|
56
|
+
if not self.chat_id and not self.login:
|
|
57
|
+
raise ValueError("Необходимо указать либо chat_id либо login")
|
|
58
|
+
return self
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class SendImageParams(BaseModel):
|
|
62
|
+
"""
|
|
63
|
+
Параметры для метода sendImage.
|
|
64
|
+
Файл передается отдельно через multipart/form-data.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
chat_id: Optional[str] = Field(None, title="ID чата (для групповых чатов)")
|
|
68
|
+
login: Optional[str] = Field(None, title="Login пользователя (для приватных чатов)")
|
|
69
|
+
thread_id: Optional[int] = Field(None, title="ID треда")
|
|
70
|
+
|
|
71
|
+
@model_validator(mode="after")
|
|
72
|
+
def validate_chat_or_login(self):
|
|
73
|
+
if not self.chat_id and not self.login:
|
|
74
|
+
raise ValueError("Необходимо указать либо chat_id либо login")
|
|
75
|
+
return self
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class SendFileParams(BaseModel):
|
|
79
|
+
"""
|
|
80
|
+
Параметры для метода sendFile.
|
|
81
|
+
Файл передается через multipart/form-data с Content-Disposition для имени.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
chat_id: Optional[str] = Field(None, title="ID чата (для групповых чатов)")
|
|
85
|
+
login: Optional[str] = Field(None, title="Login пользователя (для приватных чатов)")
|
|
86
|
+
thread_id: Optional[int] = Field(None, title="ID треда")
|
|
87
|
+
|
|
88
|
+
@model_validator(mode="after")
|
|
89
|
+
def validate_chat_or_login(self):
|
|
90
|
+
if not self.chat_id and not self.login:
|
|
91
|
+
raise ValueError("Необходимо указать либо chat_id либо login")
|
|
92
|
+
return self
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class GetUpdatesParams(BaseModel):
|
|
96
|
+
"""Параметры для метода getUpdates"""
|
|
97
|
+
|
|
98
|
+
limit: Optional[int] = Field(
|
|
99
|
+
100,
|
|
100
|
+
title="Количество обновлений (по умолчанию 100, макс 1000)",
|
|
101
|
+
ge=1,
|
|
102
|
+
le=1000,
|
|
103
|
+
)
|
|
104
|
+
offset: Optional[int] = Field(0, title="Смещение для пагинации", ge=0)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class SetWebhookParams(BaseModel):
|
|
108
|
+
"""Параметры для метода setWebhook"""
|
|
109
|
+
|
|
110
|
+
webhook_url: Optional[str] = Field(
|
|
111
|
+
None, title="URL для webhook (null для отключения)"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class MessageResponse(BaseModel):
|
|
116
|
+
"""Стандартный ответ от API после отправки сообщения"""
|
|
117
|
+
|
|
118
|
+
ok: bool = Field(..., title="Успешность операции")
|
|
119
|
+
message_id: Optional[int] = Field(None, title="ID созданного сообщения")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class UpdatesResponse(BaseModel):
|
|
123
|
+
"""Ответ от метода getUpdates"""
|
|
124
|
+
|
|
125
|
+
ok: bool = Field(..., title="Успешность операции")
|
|
126
|
+
updates: List[Update] = Field(..., title="Массив обновлений")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: multibotkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Functional library for developing multiplatform chatbots
|
|
5
5
|
Home-page: https://github.com/Appvelox/multibotkit
|
|
6
6
|
Author: Appvelox LLC
|
|
@@ -9,17 +9,28 @@ Classifier: Intended Audience :: Developers
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: httpx>=0.
|
|
16
|
-
Requires-Dist: pydantic<
|
|
17
|
-
Requires-Dist: tenacity>=
|
|
15
|
+
Requires-Dist: httpx>=0.28.1
|
|
16
|
+
Requires-Dist: pydantic<3
|
|
17
|
+
Requires-Dist: tenacity>=9.1.2
|
|
18
18
|
Requires-Dist: aiofiles>=22.1.0
|
|
19
19
|
Provides-Extra: mongo
|
|
20
|
-
Requires-Dist: motor>=3.
|
|
20
|
+
Requires-Dist: motor>=3.7.0; extra == "mongo"
|
|
21
21
|
Provides-Extra: redis
|
|
22
|
-
Requires-Dist: redis>=
|
|
22
|
+
Requires-Dist: redis>=7.1.0; extra == "redis"
|
|
23
|
+
Dynamic: author
|
|
24
|
+
Dynamic: author-email
|
|
25
|
+
Dynamic: classifier
|
|
26
|
+
Dynamic: description
|
|
27
|
+
Dynamic: description-content-type
|
|
28
|
+
Dynamic: home-page
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
Dynamic: provides-extra
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
Dynamic: summary
|
|
23
34
|
|
|
24
35
|
# multibotkit
|
|
25
36
|
Functional library for developing multiplatform chatbots
|
|
@@ -5,18 +5,20 @@ multibotkit/dispatchers/fb.py,sha256=exb5918H4JNZsKqoIvXijJhOVcRPF6pECTwTN1lQRi0
|
|
|
5
5
|
multibotkit/dispatchers/telegram.py,sha256=R8ybh_L4OWNEV2JykPK6597cFoVt3-ZBJbmxf49gyhs,2761
|
|
6
6
|
multibotkit/dispatchers/viber.py,sha256=Lqj_N86ej1Q2dx0ViBIHrFdsMS_KHh_yezkrfPvXuLE,1780
|
|
7
7
|
multibotkit/dispatchers/vk.py,sha256=EsFOL2g3ju-nhsdyRY4JBTJxqQPmaPAB7Mkn462s4tk,1918
|
|
8
|
+
multibotkit/dispatchers/yandexmessenger.py,sha256=vF1MhO4BMDrmYBOVGocsfncQRGji0ajHuZM8NVFm8O0,3524
|
|
8
9
|
multibotkit/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
10
|
multibotkit/helpers/base_helper.py,sha256=b4vlmwELwGUIJE0DvD2Lkk0LO-b-w0VWAnEnnYawOKQ,1462
|
|
10
|
-
multibotkit/helpers/fb.py,sha256=
|
|
11
|
-
multibotkit/helpers/telegram.py,sha256=
|
|
12
|
-
multibotkit/helpers/viber.py,sha256=
|
|
13
|
-
multibotkit/helpers/vk.py,sha256=
|
|
11
|
+
multibotkit/helpers/fb.py,sha256=ebeCtpu4B5lydSRTlpPudmmgFxn0UBmcsoCVNbbSEpk,4363
|
|
12
|
+
multibotkit/helpers/telegram.py,sha256=prqpYHz3GpgebVHNUA6INh5_Jsz83-38HsLBmHgsDw0,67917
|
|
13
|
+
multibotkit/helpers/viber.py,sha256=z1by5VYjJDdgnR0mBK53BVdFammeiS1OryGAq88IVZE,9270
|
|
14
|
+
multibotkit/helpers/vk.py,sha256=TwdI4nKu0EB1imXG7it04QAE4rnSl_VdBKzxx-paEwI,5942
|
|
15
|
+
multibotkit/helpers/yandexmessenger.py,sha256=ozKoNS0KNLpZz8FWleKQdP9WCg6y9xRtF452mz1sG4E,14657
|
|
14
16
|
multibotkit/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
17
|
multibotkit/schemas/fb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
18
|
multibotkit/schemas/fb/incoming.py,sha256=sp4CeQohaDMOxz113dNxJDv_fSaGW5i8qzVS7FKdvcU,3158
|
|
17
19
|
multibotkit/schemas/fb/outgoing.py,sha256=Qm0gPHHipAolXpnOJC4J4bfYjQEWpX54vYygSwKtIV4,8036
|
|
18
20
|
multibotkit/schemas/telegram/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
multibotkit/schemas/telegram/incoming.py,sha256=
|
|
21
|
+
multibotkit/schemas/telegram/incoming.py,sha256=fx_lm1O3SdoQygURm16CKcq_IvJTlzMB9PNHRAPQufA,15413
|
|
20
22
|
multibotkit/schemas/telegram/outgoing.py,sha256=5koNY9GXmYdnlJDzbvZ0UCPB_gfmodBDq1subS9awqc,13559
|
|
21
23
|
multibotkit/schemas/viber/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
24
|
multibotkit/schemas/viber/incoming.py,sha256=0sS9g-NmQFl_uoVz8pkbQ9zdNsXvGE52KxmzADoFIRM,4193
|
|
@@ -24,6 +26,9 @@ multibotkit/schemas/viber/outgoing.py,sha256=KI73IX-aawtAx3ejW2Hx0ivXBYuMVudUxhw
|
|
|
24
26
|
multibotkit/schemas/vk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
27
|
multibotkit/schemas/vk/incoming.py,sha256=XHoNNZTf7Iucou_5jN4qXGVnqquz2V3Rf8RNqIZmhnk,2063
|
|
26
28
|
multibotkit/schemas/vk/outgoing.py,sha256=HZM4SVKFKhuEAQwZkdqH3_4_MTiQlOX5NwjlrwTOqOg,3918
|
|
29
|
+
multibotkit/schemas/yandexmessenger/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
multibotkit/schemas/yandexmessenger/incoming.py,sha256=J6Uaofg5s5tH7aPoT21wjLdBQ6MYrBZ5oQZICZV6joM,3160
|
|
31
|
+
multibotkit/schemas/yandexmessenger/outgoing.py,sha256=PtaEYRLX8Ns5yMyRRDhVQ7WqXVDEq0nR2XA1RexdyFY,5292
|
|
27
32
|
multibotkit/states/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
33
|
multibotkit/states/state.py,sha256=kHiRvpSUo5FkB8d2u04fb4tbpQndJAcFvY92iSHck74,1002
|
|
29
34
|
multibotkit/states/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -31,8 +36,8 @@ multibotkit/states/managers/base.py,sha256=KOO-wtbj984-lLq6u6LhxR79NTftQV2c5uUG6
|
|
|
31
36
|
multibotkit/states/managers/memory.py,sha256=uN064uj2Q0ivK9LGEHJFaaaG6FEyXkIajS87TCAuYsI,1328
|
|
32
37
|
multibotkit/states/managers/mongo.py,sha256=K8upbLT0892YA2Qi9dDPXDP5jvQoS16T8FW-qapv1Xk,1927
|
|
33
38
|
multibotkit/states/managers/redis.py,sha256=XMpQ8LUdO9mZq3cZXlYOcGCC0VsSbsxBsEzVFH7TeEM,1681
|
|
34
|
-
multibotkit-0.
|
|
35
|
-
multibotkit-0.
|
|
36
|
-
multibotkit-0.
|
|
37
|
-
multibotkit-0.
|
|
38
|
-
multibotkit-0.
|
|
39
|
+
multibotkit-0.2.0.dist-info/licenses/LICENSE,sha256=3iCLdX93Z5F6PpDqN6q7wufsBixXuTAYwgzntBQjYBQ,1069
|
|
40
|
+
multibotkit-0.2.0.dist-info/METADATA,sha256=F5AxRSvy8CpbvkUmN85ZnRtmw_R9t18zmC-gaUIUScg,1069
|
|
41
|
+
multibotkit-0.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
42
|
+
multibotkit-0.2.0.dist-info/top_level.txt,sha256=Meo5tTNdc5pf6_qwW6x4Cqz5iJJlXFqUDMti96pzV2I,12
|
|
43
|
+
multibotkit-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|