pachcaio 1.0.0rc0__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 pachcaio might be problematic. Click here for more details.

Files changed (55) hide show
  1. pachcaio/__init__.py +256 -0
  2. pachcaio/api/__init__.py +42 -0
  3. pachcaio/api/client.py +469 -0
  4. pachcaio/api/models.py +2441 -0
  5. pachcaio/api/requests.py +136 -0
  6. pachcaio/bot.py +1674 -0
  7. pachcaio/dispatcher/__init__.py +15 -0
  8. pachcaio/dispatcher/context.py +124 -0
  9. pachcaio/dispatcher/dispatcher.py +279 -0
  10. pachcaio/dispatcher/errors.py +99 -0
  11. pachcaio/dispatcher/routes.py +104 -0
  12. pachcaio/events/__init__.py +7 -0
  13. pachcaio/events/delivery.py +99 -0
  14. pachcaio/events/history.py +142 -0
  15. pachcaio/events/lock.py +180 -0
  16. pachcaio/events/polling.py +96 -0
  17. pachcaio/events/processor.py +67 -0
  18. pachcaio/events/runner.py +54 -0
  19. pachcaio/events/settings.py +70 -0
  20. pachcaio/events/stream.py +340 -0
  21. pachcaio/events/supervisor.py +94 -0
  22. pachcaio/exceptions.py +121 -0
  23. pachcaio/filtering.py +167 -0
  24. pachcaio/filters/__init__.py +14 -0
  25. pachcaio/filters/command.py +126 -0
  26. pachcaio/filters/magic.py +126 -0
  27. pachcaio/fsm/__init__.py +15 -0
  28. pachcaio/fsm/context.py +169 -0
  29. pachcaio/fsm/state.py +99 -0
  30. pachcaio/fsm/storage/__init__.py +6 -0
  31. pachcaio/fsm/storage/base.py +98 -0
  32. pachcaio/fsm/storage/memory.py +64 -0
  33. pachcaio/fsm/storage/redis.py +105 -0
  34. pachcaio/protocols.py +296 -0
  35. pachcaio/py.typed +0 -0
  36. pachcaio/router.py +430 -0
  37. pachcaio/types/__init__.py +135 -0
  38. pachcaio/types/buttons.py +38 -0
  39. pachcaio/types/common.py +42 -0
  40. pachcaio/types/context.py +56 -0
  41. pachcaio/types/enums.py +48 -0
  42. pachcaio/types/events.py +128 -0
  43. pachcaio/types/inbound.py +422 -0
  44. pachcaio/types/message_actions.py +236 -0
  45. pachcaio/types/messages.py +84 -0
  46. pachcaio/types/updates.py +177 -0
  47. pachcaio/types/views.py +78 -0
  48. pachcaio/ui/__init__.py +7 -0
  49. pachcaio/ui/callback_data.py +90 -0
  50. pachcaio/ui/form.py +473 -0
  51. pachcaio/ui/keyboard.py +168 -0
  52. pachcaio/webhook.py +180 -0
  53. pachcaio-1.0.0rc0.dist-info/METADATA +132 -0
  54. pachcaio-1.0.0rc0.dist-info/RECORD +55 -0
  55. pachcaio-1.0.0rc0.dist-info/WHEEL +4 -0
pachcaio/__init__.py ADDED
@@ -0,0 +1,256 @@
1
+ """pachcaio - фреймворк ботов Пачки в стиле aiogram.
2
+
3
+ Библиотека предоставляет типизированный клиент API, диспетчер событий,
4
+ фильтры, FSM, middleware и строители кнопок и форм. Публичный API построен
5
+ так, чтобы бот описывался декларативно: роутер, обработчики и фильтры.
6
+
7
+ Example:
8
+ .. code-block:: python
9
+
10
+ from pachcaio import Bot, Dispatcher, F, Router
11
+ from pachcaio.types import Message
12
+
13
+ router = Router()
14
+
15
+ @router.message(F.text)
16
+ async def echo(message: Message) -> None:
17
+ await message.reply(message.text)
18
+
19
+ async def main() -> None:
20
+ async with Bot("token") as bot:
21
+ dispatcher = Dispatcher()
22
+ dispatcher.include_router(router)
23
+ await dispatcher.start(bot)
24
+ """
25
+
26
+ from importlib.metadata import PackageNotFoundError, version
27
+
28
+ from pachcaio.api.client import ApiClient, RetrySettings
29
+ from pachcaio.bot import Bot
30
+ from pachcaio.dispatcher import Dispatcher
31
+ from pachcaio.events.history import DeletionSettings
32
+ from pachcaio.events.lock import ConsumerLock, FileConsumerLock, RedisConsumerLock
33
+ from pachcaio.events.settings import DeliverySettings, SSESettings
34
+ from pachcaio.exceptions import (
35
+ ConsumerLockError,
36
+ FSMUnavailableError,
37
+ HandlerError,
38
+ PachcaioError,
39
+ RetryableError,
40
+ StreamUnavailable,
41
+ TransportError,
42
+ )
43
+ from pachcaio.filters import Command, CommandObject, F, Filter, MagicFilter
44
+ from pachcaio.fsm import (
45
+ FSMContext,
46
+ MemoryStorage,
47
+ State,
48
+ StatesGroup,
49
+ StorageKey,
50
+ )
51
+ from pachcaio.fsm.storage.base import BaseStorage
52
+ from pachcaio.protocols import (
53
+ BotProtocol,
54
+ EventConsumer,
55
+ EventSourceBot,
56
+ FilterProtocol,
57
+ HandlerCallable,
58
+ JsonObject,
59
+ MiddlewareProtocol,
60
+ ViewProtocol,
61
+ )
62
+ from pachcaio.router import BaseMiddleware, Router
63
+ from pachcaio.types import (
64
+ ApiMessage,
65
+ BotSelfResponse,
66
+ Button,
67
+ ButtonCallback,
68
+ Chat,
69
+ ChatAvailability,
70
+ ChatExport,
71
+ ChatMemberEvent,
72
+ ChatMemberRole,
73
+ ChatReadPosition,
74
+ ChatRef,
75
+ ChatSortField,
76
+ ChatSubtype,
77
+ CompanyMemberEvent,
78
+ DispatchOutcome,
79
+ Draft,
80
+ DraftType,
81
+ EventKind,
82
+ EventPayload,
83
+ ExportEvent,
84
+ ExportRequest,
85
+ File,
86
+ FileInput,
87
+ FileTarget,
88
+ FileType,
89
+ FormSubmission,
90
+ GroupTag,
91
+ LinkPreview,
92
+ LinkSharedEvent,
93
+ MemberEventType,
94
+ Message,
95
+ MessageApplication,
96
+ MessageEntityType,
97
+ MessageFile,
98
+ MessageHistoryResponse,
99
+ MessageSearchSort,
100
+ MessageSource,
101
+ OpenViewResult,
102
+ Page,
103
+ Reaction,
104
+ ReactionEvent,
105
+ ReactionEventType,
106
+ SearchSortOrder,
107
+ SortOrder,
108
+ StreamLink,
109
+ SubmitViewResponseResult,
110
+ Task,
111
+ TaskStatus,
112
+ Thread,
113
+ UnknownEvent,
114
+ UploadParams,
115
+ User,
116
+ UserEventType,
117
+ UserRef,
118
+ UserRole,
119
+ VideoCallEvent,
120
+ VideoCallEventType,
121
+ View,
122
+ Webhook,
123
+ WebhookEventType,
124
+ WebhookLink,
125
+ WebhookMessageThread,
126
+ WebhookVideoCallMember,
127
+ WebhookVideoCallThread,
128
+ parse_event,
129
+ )
130
+ from pachcaio.ui import ButtonBuilder, CallbackData, FormBuilder
131
+ from pachcaio.webhook import (
132
+ WebhookResponse,
133
+ WebhookResult,
134
+ parse_webhook,
135
+ verify_signature,
136
+ verify_webhook,
137
+ )
138
+
139
+ try:
140
+ __version__ = version("pachcaio")
141
+ except PackageNotFoundError: # pragma: no cover - source checkout without metadata
142
+ __version__ = "0.1.0"
143
+
144
+ __all__ = [
145
+ "ApiClient",
146
+ "ApiMessage",
147
+ "BaseMiddleware",
148
+ "BaseStorage",
149
+ "Bot",
150
+ "BotProtocol",
151
+ "Button",
152
+ "ButtonBuilder",
153
+ "ButtonCallback",
154
+ "CallbackData",
155
+ "BotSelfResponse",
156
+ "Chat",
157
+ "ChatAvailability",
158
+ "ChatExport",
159
+ "ChatMemberEvent",
160
+ "ChatMemberRole",
161
+ "ChatReadPosition",
162
+ "ChatRef",
163
+ "ChatSortField",
164
+ "ChatSubtype",
165
+ "Command",
166
+ "Draft",
167
+ "DraftType",
168
+ "ExportRequest",
169
+ "CommandObject",
170
+ "CompanyMemberEvent",
171
+ "ConsumerLock",
172
+ "ConsumerLockError",
173
+ "DeletionSettings",
174
+ "DeliverySettings",
175
+ "FileConsumerLock",
176
+ "RedisConsumerLock",
177
+ "Dispatcher",
178
+ "DispatchOutcome",
179
+ "EventConsumer",
180
+ "EventKind",
181
+ "EventSourceBot",
182
+ "ExportEvent",
183
+ "F",
184
+ "FSMContext",
185
+ "FSMUnavailableError",
186
+ "File",
187
+ "FileInput",
188
+ "FileTarget",
189
+ "FileType",
190
+ "Filter",
191
+ "FilterProtocol",
192
+ "FormBuilder",
193
+ "HandlerCallable",
194
+ "HandlerError",
195
+ "JsonObject",
196
+ "LinkPreview",
197
+ "LinkSharedEvent",
198
+ "MagicFilter",
199
+ "MemberEventType",
200
+ "MemoryStorage",
201
+ "Message",
202
+ "MessageApplication",
203
+ "MessageEntityType",
204
+ "MessageFile",
205
+ "MessageHistoryResponse",
206
+ "MessageSearchSort",
207
+ "MessageSource",
208
+ "MiddlewareProtocol",
209
+ "OpenViewResult",
210
+ "PachcaioError",
211
+ "Page",
212
+ "RetryableError",
213
+ "RetrySettings",
214
+ "Reaction",
215
+ "ReactionEventType",
216
+ "ReactionEvent",
217
+ "SearchSortOrder",
218
+ "Router",
219
+ "SSESettings",
220
+ "SortOrder",
221
+ "State",
222
+ "StatesGroup",
223
+ "StorageKey",
224
+ "StreamLink",
225
+ "StreamUnavailable",
226
+ "SubmitViewResponseResult",
227
+ "Task",
228
+ "TaskStatus",
229
+ "Thread",
230
+ "TransportError",
231
+ "UnknownEvent",
232
+ "EventPayload",
233
+ "UploadParams",
234
+ "User",
235
+ "UserEventType",
236
+ "UserRef",
237
+ "UserRole",
238
+ "VideoCallEventType",
239
+ "VideoCallEvent",
240
+ "View",
241
+ "ViewProtocol",
242
+ "FormSubmission",
243
+ "GroupTag",
244
+ "Webhook",
245
+ "WebhookEventType",
246
+ "WebhookResponse",
247
+ "WebhookResult",
248
+ "WebhookLink",
249
+ "WebhookMessageThread",
250
+ "WebhookVideoCallMember",
251
+ "WebhookVideoCallThread",
252
+ "parse_event",
253
+ "parse_webhook",
254
+ "verify_signature",
255
+ "verify_webhook",
256
+ ]
@@ -0,0 +1,42 @@
1
+ """Клиент API Пачки и сгенерированные pydantic-модели."""
2
+
3
+ from .client import PACHCA_API_URL, ApiClient, RetrySettings
4
+ from .models import (
5
+ Button,
6
+ Chat,
7
+ File,
8
+ FileTarget,
9
+ FileType,
10
+ Message,
11
+ MessageEntityType,
12
+ OpenViewResult,
13
+ Reaction,
14
+ SortOrder,
15
+ SubmitViewResponseResult,
16
+ Thread,
17
+ UploadParams,
18
+ User,
19
+ )
20
+ from .requests import MessageFile, Page
21
+
22
+ __all__ = [
23
+ "PACHCA_API_URL",
24
+ "ApiClient",
25
+ "Button",
26
+ "Chat",
27
+ "File",
28
+ "FileTarget",
29
+ "FileType",
30
+ "Message",
31
+ "MessageEntityType",
32
+ "MessageFile",
33
+ "OpenViewResult",
34
+ "Page",
35
+ "Reaction",
36
+ "RetrySettings",
37
+ "SortOrder",
38
+ "SubmitViewResponseResult",
39
+ "Thread",
40
+ "UploadParams",
41
+ "User",
42
+ ]