satori-python 0.11.3__tar.gz → 0.11.4__tar.gz

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.
Files changed (25) hide show
  1. {satori_python-0.11.3 → satori_python-0.11.4}/PKG-INFO +1 -1
  2. {satori_python-0.11.3 → satori_python-0.11.4}/pyproject.toml +1 -1
  3. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/__init__.py +1 -1
  4. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/client/__init__.py +9 -2
  5. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/element.py +13 -5
  6. {satori_python-0.11.3 → satori_python-0.11.4}/LICENSE +0 -0
  7. {satori_python-0.11.3 → satori_python-0.11.4}/README.md +0 -0
  8. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/client/account.py +0 -0
  9. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/client/account.pyi +0 -0
  10. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/client/network/__init__.py +0 -0
  11. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/client/network/base.py +0 -0
  12. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/client/network/webhook.py +0 -0
  13. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/client/network/websocket.py +0 -0
  14. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/client/session.py +0 -0
  15. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/config.py +0 -0
  16. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/const.py +0 -0
  17. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/event.py +0 -0
  18. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/exception.py +0 -0
  19. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/model.py +0 -0
  20. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/parser.py +0 -0
  21. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/server/__init__.py +0 -0
  22. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/server/adapter.py +0 -0
  23. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/server/conection.py +0 -0
  24. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/server/model.py +0 -0
  25. {satori_python-0.11.3 → satori_python-0.11.4}/src/satori/server/route.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: satori-python
3
- Version: 0.11.3
3
+ Version: 0.11.4
4
4
  Summary: Satori Protocol SDK for python
5
5
  Home-page: https://github.com/RF-Tar-Railt/satori-python
6
6
  Author-Email: RF-Tar-Railt <rf_tar_railt@qq.com>
@@ -28,7 +28,7 @@ classifiers = [
28
28
  "Programming Language :: Python :: 3.12",
29
29
  "Operating System :: OS Independent",
30
30
  ]
31
- version = "0.11.3"
31
+ version = "0.11.4"
32
32
 
33
33
  [project.license]
34
34
  text = "MIT"
@@ -39,4 +39,4 @@ from .model import MessageObject as MessageObject
39
39
  from .model import Role as Role
40
40
  from .model import User as User
41
41
 
42
- __version__ = "0.11.3"
42
+ __version__ = "0.11.4"
@@ -152,13 +152,20 @@ class App(Service):
152
152
  Callable[[Account, event.InternalEvent], Awaitable[Any]],
153
153
  ]: ...
154
154
 
155
- def register_on(self, event_type: EventType):
155
+ @overload
156
+ def register_on(
157
+ self, event_type: str
158
+ ) -> Callable[
159
+ [Callable[[Account, Event], Awaitable[Any]]], Callable[[Account, Event], Awaitable[Any]]
160
+ ]: ...
161
+
162
+ def register_on(self, event_type: str | EventType):
156
163
  def decorator(
157
164
  func: Callable[[Account, Any], Awaitable[Any]], /
158
165
  ) -> Callable[[Account, Any], Awaitable[Any]]:
159
166
  @wraps(func)
160
167
  async def wrapper(account: Account, event: Event) -> Any:
161
- if event.type == event_type.value:
168
+ if event.type == event_type:
162
169
  return await func(account, event)
163
170
 
164
171
  self.register(wrapper)
@@ -160,11 +160,12 @@ class Link(Element):
160
160
  @dataclass(repr=False)
161
161
  class Resource(Element):
162
162
  src: str
163
+ title: Optional[str] = None
163
164
  extra: InitVar[Optional[Dict[str, Any]]] = None
164
165
  cache: Optional[bool] = None
165
166
  timeout: Optional[str] = None
166
167
 
167
- __names__ = ("src",)
168
+ __names__ = ("src", "title")
168
169
 
169
170
  @classmethod
170
171
  def of(
@@ -173,9 +174,12 @@ class Resource(Element):
173
174
  path: Optional[Union[str, Path]] = None,
174
175
  raw: Optional[Union[bytes, BytesIO]] = None,
175
176
  mime: Optional[str] = None,
177
+ name: Optional[str] = None,
178
+ poster: Optional[str] = None,
176
179
  extra: Optional[Dict[str, Any]] = None,
177
180
  cache: Optional[bool] = None,
178
181
  timeout: Optional[str] = None,
182
+ **kwargs,
179
183
  ):
180
184
  data: Dict[str, Any] = {"extra": extra}
181
185
  if url is not None:
@@ -187,6 +191,10 @@ class Resource(Element):
187
191
  data = {"src": f"data:{mime};base64,{b64encode(bd).decode()}"}
188
192
  else:
189
193
  raise ValueError(f"{cls} need at least one of url, path and raw")
194
+ if name is not None:
195
+ data["title"] = name
196
+ if poster is not None and cls in (Video, Audio, File):
197
+ data["poster"] = poster
190
198
  if cache is not None:
191
199
  data["cache"] = cache
192
200
  if timeout is not None:
@@ -206,7 +214,7 @@ class Image(Resource):
206
214
  width: Optional[int] = None
207
215
  height: Optional[int] = None
208
216
 
209
- __names__ = ("src", "width", "height")
217
+ __names__ = ("src", "title", "width", "height")
210
218
 
211
219
  @property
212
220
  @override
@@ -221,7 +229,7 @@ class Audio(Resource):
221
229
  duration: Optional[int] = None
222
230
  poster: Optional[str] = None
223
231
 
224
- __names__ = ("src", "duration", "poster")
232
+ __names__ = ("src", "title", "duration", "poster")
225
233
 
226
234
 
227
235
  @dataclass(repr=False)
@@ -233,7 +241,7 @@ class Video(Resource):
233
241
  duration: Optional[int] = None
234
242
  poster: Optional[str] = None
235
243
 
236
- __names__ = ("src", "width", "height", "duration", "poster")
244
+ __names__ = ("src", "title", "width", "height", "duration", "poster")
237
245
 
238
246
 
239
247
  @dataclass(repr=False)
@@ -242,7 +250,7 @@ class File(Resource):
242
250
 
243
251
  poster: Optional[str] = None
244
252
 
245
- __names__ = ("src", "poster")
253
+ __names__ = ("src", "title", "poster")
246
254
 
247
255
 
248
256
  @dataclass(init=False, repr=False)
File without changes
File without changes