chatom 0.1.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.
- chatom/__init__.py +296 -0
- chatom/backend/__init__.py +29 -0
- chatom/backend/backend.py +1878 -0
- chatom/backend/backend_config.py +123 -0
- chatom/backend/backend_registry.py +296 -0
- chatom/base/__init__.py +153 -0
- chatom/base/attachment.py +158 -0
- chatom/base/authorization.py +407 -0
- chatom/base/base.py +139 -0
- chatom/base/capabilities.py +294 -0
- chatom/base/channel.py +232 -0
- chatom/base/connection.py +532 -0
- chatom/base/conversion.py +416 -0
- chatom/base/embed.py +183 -0
- chatom/base/mention.py +352 -0
- chatom/base/message.py +777 -0
- chatom/base/organization.py +68 -0
- chatom/base/presence.py +150 -0
- chatom/base/reaction.py +166 -0
- chatom/base/testing.py +466 -0
- chatom/base/thread.py +75 -0
- chatom/base/user.py +117 -0
- chatom/csp/__init__.py +54 -0
- chatom/csp/adapter.py +180 -0
- chatom/csp/nodes.py +459 -0
- chatom/discord/__init__.py +41 -0
- chatom/discord/backend.py +1440 -0
- chatom/discord/channel.py +112 -0
- chatom/discord/config.py +109 -0
- chatom/discord/guild.py +83 -0
- chatom/discord/mention.py +67 -0
- chatom/discord/message.py +353 -0
- chatom/discord/presence.py +90 -0
- chatom/discord/testing.py +759 -0
- chatom/discord/user.py +106 -0
- chatom/enums.py +60 -0
- chatom/examples/__init__.py +6 -0
- chatom/examples/basic_connection.py +162 -0
- chatom/examples/cross_platform_bot.py +244 -0
- chatom/examples/direct_messages.py +231 -0
- chatom/examples/formatted_messages.py +284 -0
- chatom/examples/listen_for_messages.py +225 -0
- chatom/examples/mentions_and_reactions.py +294 -0
- chatom/examples/message_history.py +246 -0
- chatom/examples/send_message.py +210 -0
- chatom/examples/threads_and_replies.py +276 -0
- chatom/format/__init__.py +135 -0
- chatom/format/attachment.py +102 -0
- chatom/format/components.py +768 -0
- chatom/format/message.py +591 -0
- chatom/format/table.py +323 -0
- chatom/format/text.py +615 -0
- chatom/format/variant.py +63 -0
- chatom/slack/__init__.py +38 -0
- chatom/slack/backend.py +1197 -0
- chatom/slack/channel.py +124 -0
- chatom/slack/config.py +141 -0
- chatom/slack/mention.py +76 -0
- chatom/slack/message.py +388 -0
- chatom/slack/presence.py +87 -0
- chatom/slack/testing.py +753 -0
- chatom/slack/user.py +90 -0
- chatom/symphony/__init__.py +39 -0
- chatom/symphony/backend.py +1350 -0
- chatom/symphony/channel.py +115 -0
- chatom/symphony/config.py +616 -0
- chatom/symphony/mention.py +77 -0
- chatom/symphony/message.py +381 -0
- chatom/symphony/presence.py +68 -0
- chatom/symphony/testing.py +816 -0
- chatom/symphony/user.py +92 -0
- chatom/tests/combined_e2e.py +587 -0
- chatom/tests/conversion/test_message_conversion.py +191 -0
- chatom/tests/conversion/test_message_conversion_cross.py +43 -0
- chatom/tests/conversion/test_message_conversion_discord.py +59 -0
- chatom/tests/conversion/test_message_conversion_slack.py +298 -0
- chatom/tests/conversion/test_message_conversion_symphony.py +364 -0
- chatom/tests/discord_e2e.py +1045 -0
- chatom/tests/integration/__init__.py +8 -0
- chatom/tests/integration/test_discord_integration.py +231 -0
- chatom/tests/integration/test_slack_integration.py +315 -0
- chatom/tests/integration/test_symphony_integration.py +226 -0
- chatom/tests/slack_e2e.py +954 -0
- chatom/tests/symphony_e2e.py +1241 -0
- chatom/tests/test_all.py +178 -0
- chatom/tests/test_backend.py +183 -0
- chatom/tests/test_backend_registry.py +1476 -0
- chatom/tests/test_backends.py +690 -0
- chatom/tests/test_base_models.py +1034 -0
- chatom/tests/test_bot_features.py +443 -0
- chatom/tests/test_config.py +612 -0
- chatom/tests/test_connection.py +498 -0
- chatom/tests/test_conversion.py +898 -0
- chatom/tests/test_csp.py +679 -0
- chatom/tests/test_enums.py +38 -0
- chatom/tests/test_format.py +2481 -0
- chatom/tests/test_mention.py +367 -0
- chatom/tests/test_mock_backends.py +2844 -0
- chatom/tests/test_testing.py +349 -0
- chatom-0.1.0.dist-info/METADATA +490 -0
- chatom-0.1.0.dist-info/RECORD +104 -0
- chatom-0.1.0.dist-info/WHEEL +4 -0
- chatom-0.1.0.dist-info/entry_points.txt +4 -0
- chatom-0.1.0.dist-info/licenses/LICENSE +201 -0
chatom/__init__.py
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"""Chatom - Framework-agnostic chat application representations.
|
|
2
|
+
|
|
3
|
+
Chatom provides a unified interface for working with chat platforms.
|
|
4
|
+
It includes representations for users, channels, threads, messages,
|
|
5
|
+
reactions, presence, and more.
|
|
6
|
+
|
|
7
|
+
Example:
|
|
8
|
+
>>> from chatom import User, Channel, Message, mention_user
|
|
9
|
+
>>> user = User(id="123", name="John Doe", handle="johndoe")
|
|
10
|
+
>>> channel = Channel(id="456", name="general")
|
|
11
|
+
>>> msg = Message(content="Hello, world!", author=user, channel=channel)
|
|
12
|
+
>>> print(mention_user(user))
|
|
13
|
+
John Doe
|
|
14
|
+
|
|
15
|
+
For platform-specific functionality, import from the backend modules:
|
|
16
|
+
>>> from chatom.discord import DiscordUser, mention_user
|
|
17
|
+
>>> from chatom.slack import SlackUser
|
|
18
|
+
>>> from chatom.symphony import SymphonyUser
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from .backend import (
|
|
22
|
+
Backend,
|
|
23
|
+
BackendBase,
|
|
24
|
+
BackendConfig,
|
|
25
|
+
BackendRegistry,
|
|
26
|
+
get_backend,
|
|
27
|
+
get_backend_format,
|
|
28
|
+
list_backends,
|
|
29
|
+
register_backend,
|
|
30
|
+
)
|
|
31
|
+
from .base import (
|
|
32
|
+
DISCORD_CAPABILITIES,
|
|
33
|
+
SLACK_CAPABILITIES,
|
|
34
|
+
SYMPHONY_CAPABILITIES,
|
|
35
|
+
# Presence
|
|
36
|
+
Activity,
|
|
37
|
+
ActivityType,
|
|
38
|
+
# Attachment
|
|
39
|
+
Attachment,
|
|
40
|
+
AttachmentType,
|
|
41
|
+
# Capabilities
|
|
42
|
+
BackendCapabilities,
|
|
43
|
+
# Conversion utilities
|
|
44
|
+
BackendNotFoundError,
|
|
45
|
+
# Base classes
|
|
46
|
+
BaseModel,
|
|
47
|
+
Capability,
|
|
48
|
+
# Channel
|
|
49
|
+
Channel,
|
|
50
|
+
ChannelRegistry,
|
|
51
|
+
ChannelType,
|
|
52
|
+
# Connection and registries
|
|
53
|
+
Connection,
|
|
54
|
+
ConversionError,
|
|
55
|
+
# Embed
|
|
56
|
+
Embed,
|
|
57
|
+
EmbedAuthor,
|
|
58
|
+
EmbedField,
|
|
59
|
+
EmbedFooter,
|
|
60
|
+
EmbedMedia,
|
|
61
|
+
# Reaction
|
|
62
|
+
Emoji,
|
|
63
|
+
Field,
|
|
64
|
+
File,
|
|
65
|
+
Identifiable,
|
|
66
|
+
Image,
|
|
67
|
+
LookupError,
|
|
68
|
+
# Message
|
|
69
|
+
Message,
|
|
70
|
+
MessageReference,
|
|
71
|
+
MessageType,
|
|
72
|
+
# Organization
|
|
73
|
+
Organization,
|
|
74
|
+
Presence,
|
|
75
|
+
PresenceStatus,
|
|
76
|
+
Reaction,
|
|
77
|
+
# Thread
|
|
78
|
+
Thread,
|
|
79
|
+
# User
|
|
80
|
+
User,
|
|
81
|
+
UserRegistry,
|
|
82
|
+
ValidationResult,
|
|
83
|
+
can_promote,
|
|
84
|
+
demote,
|
|
85
|
+
get_backend_type,
|
|
86
|
+
get_base_type,
|
|
87
|
+
list_backends_for_type,
|
|
88
|
+
# Mention utilities
|
|
89
|
+
mention_channel,
|
|
90
|
+
mention_channel_for_backend,
|
|
91
|
+
mention_user,
|
|
92
|
+
mention_user_for_backend,
|
|
93
|
+
promote,
|
|
94
|
+
register_backend_type,
|
|
95
|
+
validate_for_backend,
|
|
96
|
+
)
|
|
97
|
+
from .enums import (
|
|
98
|
+
ALL_BACKENDS,
|
|
99
|
+
BACKEND,
|
|
100
|
+
DISCORD,
|
|
101
|
+
SLACK,
|
|
102
|
+
SYMPHONY,
|
|
103
|
+
)
|
|
104
|
+
from .format import (
|
|
105
|
+
BACKEND_FORMAT_MAP,
|
|
106
|
+
DISCORD_MARKDOWN,
|
|
107
|
+
FORMAT,
|
|
108
|
+
HTML,
|
|
109
|
+
MARKDOWN,
|
|
110
|
+
PLAINTEXT,
|
|
111
|
+
SLACK_MARKDOWN,
|
|
112
|
+
SYMPHONY_MESSAGEML,
|
|
113
|
+
Bold,
|
|
114
|
+
ChannelMention,
|
|
115
|
+
Code,
|
|
116
|
+
CodeBlock,
|
|
117
|
+
Document,
|
|
118
|
+
# Variant/Format
|
|
119
|
+
Format,
|
|
120
|
+
# Attachment formatting
|
|
121
|
+
FormattedAttachment,
|
|
122
|
+
FormattedImage,
|
|
123
|
+
# Message formatting
|
|
124
|
+
FormattedMessage,
|
|
125
|
+
Heading,
|
|
126
|
+
HorizontalRule,
|
|
127
|
+
Italic,
|
|
128
|
+
LineBreak,
|
|
129
|
+
Link,
|
|
130
|
+
ListItem,
|
|
131
|
+
MessageBuilder,
|
|
132
|
+
OrderedList,
|
|
133
|
+
Paragraph,
|
|
134
|
+
Quote,
|
|
135
|
+
Span,
|
|
136
|
+
Strikethrough,
|
|
137
|
+
# Table
|
|
138
|
+
Table,
|
|
139
|
+
TableAlignment,
|
|
140
|
+
TableCell,
|
|
141
|
+
TableRow,
|
|
142
|
+
Text,
|
|
143
|
+
# Text nodes
|
|
144
|
+
TextNode,
|
|
145
|
+
Underline,
|
|
146
|
+
UnorderedList,
|
|
147
|
+
UserMention,
|
|
148
|
+
bold,
|
|
149
|
+
code,
|
|
150
|
+
code_block,
|
|
151
|
+
format_message,
|
|
152
|
+
get_format_for_backend,
|
|
153
|
+
italic,
|
|
154
|
+
link,
|
|
155
|
+
render_message,
|
|
156
|
+
# Helper functions
|
|
157
|
+
text,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
__version__ = "0.1.0"
|
|
161
|
+
|
|
162
|
+
__all__ = (
|
|
163
|
+
# Version
|
|
164
|
+
"__version__",
|
|
165
|
+
# Backend
|
|
166
|
+
"Backend",
|
|
167
|
+
"BackendConfig",
|
|
168
|
+
# Backend registry
|
|
169
|
+
"BackendBase",
|
|
170
|
+
"BackendRegistry",
|
|
171
|
+
"get_backend",
|
|
172
|
+
"get_backend_format",
|
|
173
|
+
"list_backends",
|
|
174
|
+
"register_backend",
|
|
175
|
+
# Enums
|
|
176
|
+
"BACKEND",
|
|
177
|
+
"DISCORD",
|
|
178
|
+
"SLACK",
|
|
179
|
+
"SYMPHONY",
|
|
180
|
+
"ALL_BACKENDS",
|
|
181
|
+
# Base classes
|
|
182
|
+
"BaseModel",
|
|
183
|
+
"Field",
|
|
184
|
+
"Identifiable",
|
|
185
|
+
# User
|
|
186
|
+
"User",
|
|
187
|
+
# Channel
|
|
188
|
+
"Channel",
|
|
189
|
+
"ChannelType",
|
|
190
|
+
# Thread
|
|
191
|
+
"Thread",
|
|
192
|
+
# Message
|
|
193
|
+
"Message",
|
|
194
|
+
"MessageReference",
|
|
195
|
+
"MessageType",
|
|
196
|
+
# Attachment
|
|
197
|
+
"Attachment",
|
|
198
|
+
"AttachmentType",
|
|
199
|
+
"File",
|
|
200
|
+
"Image",
|
|
201
|
+
# Embed
|
|
202
|
+
"Embed",
|
|
203
|
+
"EmbedAuthor",
|
|
204
|
+
"EmbedField",
|
|
205
|
+
"EmbedFooter",
|
|
206
|
+
"EmbedMedia",
|
|
207
|
+
# Reaction
|
|
208
|
+
"Emoji",
|
|
209
|
+
"Reaction",
|
|
210
|
+
# Presence
|
|
211
|
+
"Activity",
|
|
212
|
+
"ActivityType",
|
|
213
|
+
"Presence",
|
|
214
|
+
"PresenceStatus",
|
|
215
|
+
# Capabilities
|
|
216
|
+
"BackendCapabilities",
|
|
217
|
+
"Capability",
|
|
218
|
+
"DISCORD_CAPABILITIES",
|
|
219
|
+
"SLACK_CAPABILITIES",
|
|
220
|
+
"SYMPHONY_CAPABILITIES",
|
|
221
|
+
# Conversion utilities
|
|
222
|
+
"BackendNotFoundError",
|
|
223
|
+
"ConversionError",
|
|
224
|
+
"ValidationResult",
|
|
225
|
+
"can_promote",
|
|
226
|
+
"demote",
|
|
227
|
+
"get_backend_type",
|
|
228
|
+
"get_base_type",
|
|
229
|
+
"list_backends_for_type",
|
|
230
|
+
"promote",
|
|
231
|
+
"register_backend_type",
|
|
232
|
+
"validate_for_backend",
|
|
233
|
+
# Mention utilities
|
|
234
|
+
"mention_channel",
|
|
235
|
+
"mention_user",
|
|
236
|
+
"mention_channel_for_backend",
|
|
237
|
+
"mention_user_for_backend",
|
|
238
|
+
# Connection and registries
|
|
239
|
+
"Connection",
|
|
240
|
+
"UserRegistry",
|
|
241
|
+
"ChannelRegistry",
|
|
242
|
+
"LookupError",
|
|
243
|
+
# Format
|
|
244
|
+
"Format",
|
|
245
|
+
"FORMAT",
|
|
246
|
+
"PLAINTEXT",
|
|
247
|
+
"MARKDOWN",
|
|
248
|
+
"SLACK_MARKDOWN",
|
|
249
|
+
"DISCORD_MARKDOWN",
|
|
250
|
+
"HTML",
|
|
251
|
+
"SYMPHONY_MESSAGEML",
|
|
252
|
+
# Text nodes
|
|
253
|
+
"TextNode",
|
|
254
|
+
"Text",
|
|
255
|
+
"Bold",
|
|
256
|
+
"Italic",
|
|
257
|
+
"Strikethrough",
|
|
258
|
+
"Underline",
|
|
259
|
+
"Code",
|
|
260
|
+
"CodeBlock",
|
|
261
|
+
"Link",
|
|
262
|
+
"Quote",
|
|
263
|
+
"Paragraph",
|
|
264
|
+
"LineBreak",
|
|
265
|
+
"HorizontalRule",
|
|
266
|
+
"ListItem",
|
|
267
|
+
"UnorderedList",
|
|
268
|
+
"OrderedList",
|
|
269
|
+
"Heading",
|
|
270
|
+
"UserMention",
|
|
271
|
+
"ChannelMention",
|
|
272
|
+
"Span",
|
|
273
|
+
"Document",
|
|
274
|
+
# Helper functions
|
|
275
|
+
"text",
|
|
276
|
+
"bold",
|
|
277
|
+
"italic",
|
|
278
|
+
"code",
|
|
279
|
+
"code_block",
|
|
280
|
+
"link",
|
|
281
|
+
# Table
|
|
282
|
+
"Table",
|
|
283
|
+
"TableRow",
|
|
284
|
+
"TableCell",
|
|
285
|
+
"TableAlignment",
|
|
286
|
+
# Attachment formatting
|
|
287
|
+
"FormattedAttachment",
|
|
288
|
+
"FormattedImage",
|
|
289
|
+
# Message formatting
|
|
290
|
+
"FormattedMessage",
|
|
291
|
+
"MessageBuilder",
|
|
292
|
+
"render_message",
|
|
293
|
+
"format_message",
|
|
294
|
+
"BACKEND_FORMAT_MAP",
|
|
295
|
+
"get_format_for_backend",
|
|
296
|
+
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Backend module for chatom.
|
|
2
|
+
|
|
3
|
+
This module provides the backend base class, configuration, and registry.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .backend import Backend, BackendBase, SyncHelper
|
|
7
|
+
from .backend_config import BackendConfig
|
|
8
|
+
from .backend_registry import (
|
|
9
|
+
BackendRegistry,
|
|
10
|
+
get_backend,
|
|
11
|
+
get_backend_format,
|
|
12
|
+
list_backends,
|
|
13
|
+
register_backend,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = (
|
|
17
|
+
# Backend base class and alias
|
|
18
|
+
"Backend",
|
|
19
|
+
"BackendBase",
|
|
20
|
+
"SyncHelper",
|
|
21
|
+
# Configuration
|
|
22
|
+
"BackendConfig",
|
|
23
|
+
# Registry
|
|
24
|
+
"BackendRegistry",
|
|
25
|
+
"get_backend",
|
|
26
|
+
"get_backend_format",
|
|
27
|
+
"list_backends",
|
|
28
|
+
"register_backend",
|
|
29
|
+
)
|