satori-python 0.12.0__tar.gz → 0.13.0__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.12.0 → satori_python-0.13.0}/PKG-INFO +12 -6
- {satori_python-0.12.0 → satori_python-0.13.0}/README.md +9 -4
- {satori_python-0.12.0 → satori_python-0.13.0}/pyproject.toml +3 -2
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/__init__.py +4 -1
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/client/account.py +13 -7
- satori_python-0.13.0/src/satori/client/account.pyi +553 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/client/network/util.py +12 -1
- satori_python-0.13.0/src/satori/client/protocol.py +767 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/const.py +2 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/element.py +1 -1
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/model.py +24 -1
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/server/__init__.py +131 -57
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/server/adapter.py +10 -16
- satori_python-0.13.0/src/satori/server/formdata.py +13 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/server/model.py +7 -2
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/server/route.py +19 -5
- satori_python-0.12.0/src/satori/client/account.pyi +0 -205
- satori_python-0.12.0/src/satori/client/session.py +0 -406
- {satori_python-0.12.0 → satori_python-0.13.0}/LICENSE +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/client/__init__.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/client/network/__init__.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/client/network/base.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/client/network/webhook.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/client/network/websocket.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/config.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/event.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/exception.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/parser.py +0 -0
- {satori_python-0.12.0 → satori_python-0.13.0}/src/satori/server/conection.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: satori-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.0
|
|
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>
|
|
@@ -22,9 +22,10 @@ Requires-Dist: loguru>=0.7.2
|
|
|
22
22
|
Requires-Dist: launart>=0.8.2
|
|
23
23
|
Requires-Dist: typing-extensions>=4.7.0
|
|
24
24
|
Requires-Dist: graia-amnesia>=0.9.0
|
|
25
|
-
Requires-Dist: starlette>=0.37.2
|
|
25
|
+
Requires-Dist: starlette[python-multipart]>=0.37.2
|
|
26
26
|
Requires-Dist: uvicorn[standard]>=0.28.0
|
|
27
27
|
Requires-Dist: yarl>=1.9.4
|
|
28
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
28
29
|
Description-Content-Type: text/markdown
|
|
29
30
|
|
|
30
31
|
# satori-python
|
|
@@ -47,6 +48,10 @@ Description-Content-Type: text/markdown
|
|
|
47
48
|
- [Chronocat](https://chronocat.vercel.app)
|
|
48
49
|
- Koishi (搭配 `@koishijs/plugin-server`)
|
|
49
50
|
|
|
51
|
+
### 使用该 SDK 的框架
|
|
52
|
+
|
|
53
|
+
- [`Entari`](https://github.com/ArcletProject/Entari)
|
|
54
|
+
|
|
50
55
|
## 安装
|
|
51
56
|
|
|
52
57
|
安装完整体:
|
|
@@ -74,14 +79,15 @@ pip install satori-python-server
|
|
|
74
79
|
客户端:
|
|
75
80
|
|
|
76
81
|
```python
|
|
77
|
-
from satori import
|
|
82
|
+
from satori import EventType, WebsocketsInfo
|
|
83
|
+
from satori.event import MessageEvent
|
|
78
84
|
from satori.client import Account, App
|
|
79
85
|
|
|
80
86
|
app = App(WebsocketsInfo(port=5140))
|
|
81
87
|
|
|
82
|
-
@app.
|
|
83
|
-
async def on_message(account: Account, event:
|
|
84
|
-
if event.user
|
|
88
|
+
@app.register_on(EventType.MESSAGE_CREATED)
|
|
89
|
+
async def on_message(account: Account, event: MessageEvent):
|
|
90
|
+
if event.user.id == "xxxxxxxxxxx":
|
|
85
91
|
await account.send(event, "Hello, World!")
|
|
86
92
|
|
|
87
93
|
app.run()
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
- [Chronocat](https://chronocat.vercel.app)
|
|
19
19
|
- Koishi (搭配 `@koishijs/plugin-server`)
|
|
20
20
|
|
|
21
|
+
### 使用该 SDK 的框架
|
|
22
|
+
|
|
23
|
+
- [`Entari`](https://github.com/ArcletProject/Entari)
|
|
24
|
+
|
|
21
25
|
## 安装
|
|
22
26
|
|
|
23
27
|
安装完整体:
|
|
@@ -45,14 +49,15 @@ pip install satori-python-server
|
|
|
45
49
|
客户端:
|
|
46
50
|
|
|
47
51
|
```python
|
|
48
|
-
from satori import
|
|
52
|
+
from satori import EventType, WebsocketsInfo
|
|
53
|
+
from satori.event import MessageEvent
|
|
49
54
|
from satori.client import Account, App
|
|
50
55
|
|
|
51
56
|
app = App(WebsocketsInfo(port=5140))
|
|
52
57
|
|
|
53
|
-
@app.
|
|
54
|
-
async def on_message(account: Account, event:
|
|
55
|
-
if event.user
|
|
58
|
+
@app.register_on(EventType.MESSAGE_CREATED)
|
|
59
|
+
async def on_message(account: Account, event: MessageEvent):
|
|
60
|
+
if event.user.id == "xxxxxxxxxxx":
|
|
56
61
|
await account.send(event, "Hello, World!")
|
|
57
62
|
|
|
58
63
|
app.run()
|
|
@@ -11,9 +11,10 @@ dependencies = [
|
|
|
11
11
|
"launart>=0.8.2",
|
|
12
12
|
"typing-extensions>=4.7.0",
|
|
13
13
|
"graia-amnesia>=0.9.0",
|
|
14
|
-
"starlette>=0.37.2",
|
|
14
|
+
"starlette[python-multipart]>=0.37.2",
|
|
15
15
|
"uvicorn[standard]>=0.28.0",
|
|
16
16
|
"yarl>=1.9.4",
|
|
17
|
+
"python-multipart>=0.0.9",
|
|
17
18
|
]
|
|
18
19
|
requires-python = ">=3.9"
|
|
19
20
|
readme = "README.md"
|
|
@@ -28,7 +29,7 @@ classifiers = [
|
|
|
28
29
|
"Programming Language :: Python :: 3.12",
|
|
29
30
|
"Operating System :: OS Independent",
|
|
30
31
|
]
|
|
31
|
-
version = "0.
|
|
32
|
+
version = "0.13.0"
|
|
32
33
|
|
|
33
34
|
[project.license]
|
|
34
35
|
text = "MIT"
|
|
@@ -36,7 +36,10 @@ from .model import Login as Login
|
|
|
36
36
|
from .model import LoginStatus as LoginStatus
|
|
37
37
|
from .model import Member as Member
|
|
38
38
|
from .model import MessageObject as MessageObject
|
|
39
|
+
from .model import PageDequeResult as PageDequeResult
|
|
40
|
+
from .model import PageResult as PageResult
|
|
39
41
|
from .model import Role as Role
|
|
42
|
+
from .model import Upload as Upload
|
|
40
43
|
from .model import User as User
|
|
41
44
|
|
|
42
|
-
__version__ = "0.
|
|
45
|
+
__version__ = "0.13.0"
|
|
@@ -8,9 +8,9 @@ from yarl import URL
|
|
|
8
8
|
|
|
9
9
|
from satori.model import Login
|
|
10
10
|
|
|
11
|
-
from .
|
|
11
|
+
from .protocol import ApiProtocol
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
TP = TypeVar("TP", bound="ApiProtocol")
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
@dataclass
|
|
@@ -36,17 +36,23 @@ class Account:
|
|
|
36
36
|
self_id: str,
|
|
37
37
|
self_info: Login,
|
|
38
38
|
config: ApiInfo,
|
|
39
|
-
|
|
39
|
+
protocol_cls: type[ApiProtocol] = ApiProtocol,
|
|
40
40
|
):
|
|
41
41
|
self.platform = platform
|
|
42
42
|
self.self_id = self_id
|
|
43
43
|
self.self_info = self_info
|
|
44
44
|
self.config = config
|
|
45
|
-
self.
|
|
45
|
+
self.protocol = protocol_cls(self) # type: ignore
|
|
46
46
|
self.connected = asyncio.Event()
|
|
47
47
|
|
|
48
|
-
def custom(self, config: ApiInfo | None = None,
|
|
49
|
-
return Account(
|
|
48
|
+
def custom(self, config: ApiInfo | None = None, protocol_cls: type[TP] = ApiProtocol, **kwargs) -> TP:
|
|
49
|
+
return Account(
|
|
50
|
+
self.platform,
|
|
51
|
+
self.self_id,
|
|
52
|
+
self.self_info,
|
|
53
|
+
config or ApiInfo(**kwargs),
|
|
54
|
+
protocol_cls, # type: ignore
|
|
55
|
+
).protocol
|
|
50
56
|
|
|
51
57
|
@property
|
|
52
58
|
def identity(self):
|
|
@@ -56,4 +62,4 @@ class Account:
|
|
|
56
62
|
return f"<Account {self.self_id} ({self.platform})>"
|
|
57
63
|
|
|
58
64
|
def __getattr__(self, item):
|
|
59
|
-
return getattr(self.
|
|
65
|
+
return getattr(self.protocol, item)
|