satori-python-client 0.16.4__tar.gz → 0.16.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_client-0.16.4 → satori_python_client-0.16.5}/PKG-INFO +12 -5
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/README.md +11 -4
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/pyproject.toml +2 -1
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/__init__.py +27 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/base.py +1 -1
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/.mina/client.toml +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/LICENSE +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/account.py +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/account.pyi +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/config.py +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/__init__.py +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/util.py +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/webhook.py +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/websocket.py +0 -0
- {satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/protocol.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: satori-python-client
|
|
3
|
-
Version: 0.16.
|
|
3
|
+
Version: 0.16.5
|
|
4
4
|
Summary: Satori Protocol SDK for python, specify client part
|
|
5
5
|
Home-page: https://github.com/RF-Tar-Railt/satori-python
|
|
6
6
|
Author-Email: RF-Tar-Railt <rf_tar_railt@qq.com>
|
|
@@ -72,10 +72,17 @@ pip install satori-python-server
|
|
|
72
72
|
|
|
73
73
|
### 官方适配器
|
|
74
74
|
|
|
75
|
-
| 适配器 | 安装 |
|
|
76
|
-
|
|
77
|
-
| Satori | `pip install satori-python-adapter-satori` |
|
|
78
|
-
| OneBot V11 | `pip install satori-python-adapter-onebot11` |
|
|
75
|
+
| 适配器 | 安装 | 路径 |
|
|
76
|
+
|------------|----------------------------------------------|--------------------------------------------------------------------|
|
|
77
|
+
| Satori | `pip install satori-python-adapter-satori` | satori.adapters.satori |
|
|
78
|
+
| OneBot V11 | `pip install satori-python-adapter-onebot11` | satori.adapters.onebot11.forward, satori.adapters.onebot11.reverse |
|
|
79
|
+
| Console | `pip install satori-python-adapter-console` | satori.adapters.console |
|
|
80
|
+
|
|
81
|
+
### 社区适配器
|
|
82
|
+
|
|
83
|
+
| 适配器 | 安装 | 路径 |
|
|
84
|
+
|-------------------|-----------------------|--------------|
|
|
85
|
+
| nekobox(Lagrange) | `pip install nekobox` | nekobox.main |
|
|
79
86
|
|
|
80
87
|
## 使用
|
|
81
88
|
|
|
@@ -47,10 +47,17 @@ pip install satori-python-server
|
|
|
47
47
|
|
|
48
48
|
### 官方适配器
|
|
49
49
|
|
|
50
|
-
| 适配器 | 安装 |
|
|
51
|
-
|
|
52
|
-
| Satori | `pip install satori-python-adapter-satori` |
|
|
53
|
-
| OneBot V11 | `pip install satori-python-adapter-onebot11` |
|
|
50
|
+
| 适配器 | 安装 | 路径 |
|
|
51
|
+
|------------|----------------------------------------------|--------------------------------------------------------------------|
|
|
52
|
+
| Satori | `pip install satori-python-adapter-satori` | satori.adapters.satori |
|
|
53
|
+
| OneBot V11 | `pip install satori-python-adapter-onebot11` | satori.adapters.onebot11.forward, satori.adapters.onebot11.reverse |
|
|
54
|
+
| Console | `pip install satori-python-adapter-console` | satori.adapters.console |
|
|
55
|
+
|
|
56
|
+
### 社区适配器
|
|
57
|
+
|
|
58
|
+
| 适配器 | 安装 | 路径 |
|
|
59
|
+
|-------------------|-----------------------|--------------|
|
|
60
|
+
| nekobox(Lagrange) | `pip install nekobox` | nekobox.main |
|
|
54
61
|
|
|
55
62
|
## 使用
|
|
56
63
|
|
|
@@ -24,7 +24,7 @@ classifiers = [
|
|
|
24
24
|
"Programming Language :: Python :: 3.12",
|
|
25
25
|
"Operating System :: OS Independent",
|
|
26
26
|
]
|
|
27
|
-
version = "0.16.
|
|
27
|
+
version = "0.16.5"
|
|
28
28
|
|
|
29
29
|
[project.license]
|
|
30
30
|
text = "MIT"
|
|
@@ -49,6 +49,7 @@ dev = [
|
|
|
49
49
|
"fix-future-annotations>=0.5.0",
|
|
50
50
|
"mina-build<0.6,>=0.5.1",
|
|
51
51
|
"pdm-mina>=0.3.2",
|
|
52
|
+
"nonechat<0.7.0,>=0.6.0",
|
|
52
53
|
]
|
|
53
54
|
|
|
54
55
|
[tool.pdm.build]
|
|
@@ -35,6 +35,28 @@ MAPPING: dict[type[Config], type[BaseNetwork]] = {
|
|
|
35
35
|
WebsocketsInfo: WsNetwork,
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
_app: App | None = None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_accounts() -> dict[str, Account]:
|
|
42
|
+
if _app is None:
|
|
43
|
+
raise RuntimeError("App instance is not initialized.")
|
|
44
|
+
return _app.accounts
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def get_app() -> App:
|
|
48
|
+
"""Get the current App instance."""
|
|
49
|
+
if _app is None:
|
|
50
|
+
raise RuntimeError("App instance is not initialized.")
|
|
51
|
+
return _app
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def get_account(self_id: str) -> Account:
|
|
55
|
+
"""Get an account by its self_id."""
|
|
56
|
+
if _app is None:
|
|
57
|
+
raise RuntimeError("App instance is not initialized.")
|
|
58
|
+
return _app.get_account(self_id)
|
|
59
|
+
|
|
38
60
|
|
|
39
61
|
class App(Service):
|
|
40
62
|
id = "satori-python.client"
|
|
@@ -51,6 +73,10 @@ class App(Service):
|
|
|
51
73
|
MAPPING[tc] = tn
|
|
52
74
|
|
|
53
75
|
def __init__(self, *configs: Config, default_api_cls: type[ApiProtocol] = ApiProtocol):
|
|
76
|
+
global _app
|
|
77
|
+
|
|
78
|
+
if _app is not None:
|
|
79
|
+
raise RuntimeError("App instance already exists. Only one App instance is allowed.")
|
|
54
80
|
self.accounts = {}
|
|
55
81
|
self.connections = []
|
|
56
82
|
self.event_callbacks = []
|
|
@@ -59,6 +85,7 @@ class App(Service):
|
|
|
59
85
|
for config in configs:
|
|
60
86
|
self.apply(config)
|
|
61
87
|
self.default_api_cls = default_api_cls
|
|
88
|
+
_app = self
|
|
62
89
|
|
|
63
90
|
def apply(self, config: Config):
|
|
64
91
|
try:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/__init__.py
RENAMED
|
File without changes
|
{satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/util.py
RENAMED
|
File without changes
|
{satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/webhook.py
RENAMED
|
File without changes
|
{satori_python_client-0.16.4 → satori_python_client-0.16.5}/src/satori/client/network/websocket.py
RENAMED
|
File without changes
|
|
File without changes
|