satori-python 0.11.3__tar.gz → 0.11.5__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.
- {satori_python-0.11.3 → satori_python-0.11.5}/PKG-INFO +2 -2
- {satori_python-0.11.3 → satori_python-0.11.5}/pyproject.toml +5 -5
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/__init__.py +1 -1
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/client/__init__.py +9 -2
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/client/account.pyi +2 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/client/session.py +12 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/element.py +13 -5
- {satori_python-0.11.3 → satori_python-0.11.5}/LICENSE +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/README.md +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/client/account.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/client/network/__init__.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/client/network/base.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/client/network/webhook.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/client/network/websocket.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/config.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/const.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/event.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/exception.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/model.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/parser.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/server/__init__.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/server/adapter.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/server/conection.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/src/satori/server/model.py +0 -0
- {satori_python-0.11.3 → satori_python-0.11.5}/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
|
+
Version: 0.11.5
|
|
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>
|
|
@@ -20,7 +20,7 @@ Requires-Python: >=3.9
|
|
|
20
20
|
Requires-Dist: aiohttp>=3.9.3
|
|
21
21
|
Requires-Dist: loguru>=0.7.2
|
|
22
22
|
Requires-Dist: launart>=0.8.2
|
|
23
|
-
Requires-Dist: typing-extensions>=4.
|
|
23
|
+
Requires-Dist: typing-extensions>=4.7.0
|
|
24
24
|
Requires-Dist: graia-amnesia>=0.9.0
|
|
25
25
|
Requires-Dist: starlette>=0.37.2
|
|
26
26
|
Requires-Dist: uvicorn[standard]>=0.28.0
|
|
@@ -9,7 +9,7 @@ dependencies = [
|
|
|
9
9
|
"aiohttp>=3.9.3",
|
|
10
10
|
"loguru>=0.7.2",
|
|
11
11
|
"launart>=0.8.2",
|
|
12
|
-
"typing-extensions>=4.
|
|
12
|
+
"typing-extensions>=4.7.0",
|
|
13
13
|
"graia-amnesia>=0.9.0",
|
|
14
14
|
"starlette>=0.37.2",
|
|
15
15
|
"uvicorn[standard]>=0.28.0",
|
|
@@ -28,7 +28,7 @@ classifiers = [
|
|
|
28
28
|
"Programming Language :: Python :: 3.12",
|
|
29
29
|
"Operating System :: OS Independent",
|
|
30
30
|
]
|
|
31
|
-
version = "0.11.
|
|
31
|
+
version = "0.11.5"
|
|
32
32
|
|
|
33
33
|
[project.license]
|
|
34
34
|
text = "MIT"
|
|
@@ -46,9 +46,9 @@ build-backend = "mina.backend"
|
|
|
46
46
|
[tool.pdm.dev-dependencies]
|
|
47
47
|
dev = [
|
|
48
48
|
"isort>=5.13.2",
|
|
49
|
-
"black>=24.
|
|
50
|
-
"ruff>=0.
|
|
51
|
-
"pre-commit>=3.
|
|
49
|
+
"black>=24.4.0",
|
|
50
|
+
"ruff>=0.4.1",
|
|
51
|
+
"pre-commit>=3.7.0",
|
|
52
52
|
"fix-future-annotations>=0.5.0",
|
|
53
53
|
"mina-build<0.6,>=0.5.1",
|
|
54
54
|
"pdm-mina>=0.3.2",
|
|
@@ -152,13 +152,20 @@ class App(Service):
|
|
|
152
152
|
Callable[[Account, event.InternalEvent], Awaitable[Any]],
|
|
153
153
|
]: ...
|
|
154
154
|
|
|
155
|
-
|
|
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
|
|
168
|
+
if event.type == event_type:
|
|
162
169
|
return await func(account, event)
|
|
163
170
|
|
|
164
171
|
self.register(wrapper)
|
|
@@ -112,6 +112,7 @@ class Account:
|
|
|
112
112
|
data: Channel,
|
|
113
113
|
) -> None: ...
|
|
114
114
|
async def channel_delete(self, *, channel_id: str) -> None: ...
|
|
115
|
+
async def channel_mute(self, *, channel_id: str, duration: float = 0) -> None: ...
|
|
115
116
|
async def user_channel_create(self, *, user_id: str, guild_id: str | None = None) -> Channel: ...
|
|
116
117
|
async def guild_get(self, *, guild_id: str) -> Guild: ...
|
|
117
118
|
async def guild_list(self, *, next_token: str | None = None) -> PageResult[Guild]: ...
|
|
@@ -121,6 +122,7 @@ class Account:
|
|
|
121
122
|
) -> PageResult[Member]: ...
|
|
122
123
|
async def guild_member_get(self, *, guild_id: str, user_id: str) -> Member: ...
|
|
123
124
|
async def guild_member_kick(self, *, guild_id: str, user_id: str, permanent: bool = False) -> None: ...
|
|
125
|
+
async def guild_member_mute(self, *, guild_id: str, user_id: str, duration: float = 0) -> None: ...
|
|
124
126
|
async def guild_member_approve(self, *, request_id: str, approve: bool, comment: str) -> None: ...
|
|
125
127
|
async def guild_member_role_set(self, *, guild_id: str, user_id: str, role_id: str) -> None: ...
|
|
126
128
|
async def guild_member_role_unset(self, *, guild_id: str, user_id: str, role_id: str) -> None: ...
|
|
@@ -197,6 +197,12 @@ class Session:
|
|
|
197
197
|
{"channel_id": channel_id},
|
|
198
198
|
)
|
|
199
199
|
|
|
200
|
+
async def channel_mute(self, channel_id: str, duration: float = 0) -> None:
|
|
201
|
+
await self.call_api(
|
|
202
|
+
Api.CHANNEL_MUTE,
|
|
203
|
+
{"channel_id": channel_id, "duration": duration},
|
|
204
|
+
)
|
|
205
|
+
|
|
200
206
|
async def user_channel_create(self, user_id: str, guild_id: str | None = None) -> Channel:
|
|
201
207
|
data = {"user_id": user_id}
|
|
202
208
|
if guild_id is not None:
|
|
@@ -247,6 +253,12 @@ class Session:
|
|
|
247
253
|
{"guild_id": guild_id, "user_id": user_id, "permanent": permanent},
|
|
248
254
|
)
|
|
249
255
|
|
|
256
|
+
async def guild_member_mute(self, guild_id: str, user_id: str, duration: float = 0) -> None:
|
|
257
|
+
await self.call_api(
|
|
258
|
+
Api.GUILD_MEMBER_MUTE,
|
|
259
|
+
{"guild_id": guild_id, "user_id": user_id, "duration": duration},
|
|
260
|
+
)
|
|
261
|
+
|
|
250
262
|
async def guild_member_approve(self, request_id: str, approve: bool, comment: str) -> None:
|
|
251
263
|
await self.call_api(
|
|
252
264
|
Api.GUILD_MEMBER_APPROVE,
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|