satori-python-adapter-milky 0.1.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.
@@ -0,0 +1,29 @@
1
+ includes = ["src/satori/adapters/milky"]
2
+ raw-dependencies = ["satori-python-server >= 0.17.2"]
3
+
4
+ [project]
5
+ name = "satori-python-adapter-milky"
6
+ version = "0.1.0"
7
+ authors = [
8
+ {name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"}
9
+ ]
10
+ dependencies = []
11
+ description = "Satori Protocol SDK for python, adapter for Milky"
12
+ license = {text = "MIT"}
13
+ readme = "README.md"
14
+ requires-python = ">=3.10,<4.0"
15
+ classifiers = [
16
+ "Typing :: Typed",
17
+ "Development Status :: 4 - Beta",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Operating System :: OS Independent",
25
+ ]
26
+
27
+ [project.urls]
28
+ homepage = "https://github.com/RF-Tar-Railt/satori-python"
29
+ repository = "https://github.com/RF-Tar-Railt/satori-python"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 RF-Tar-Railt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.1
2
+ Name: satori-python-adapter-milky
3
+ Version: 0.1.0
4
+ Summary: Satori Protocol SDK for python, adapter for Milky
5
+ Home-page: https://github.com/RF-Tar-Railt/satori-python
6
+ Author-Email: RF-Tar-Railt <rf_tar_railt@qq.com>
7
+ License: MIT
8
+ Classifier: Typing :: Typed
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Operating System :: OS Independent
17
+ Project-URL: Homepage, https://github.com/RF-Tar-Railt/satori-python
18
+ Project-URL: Repository, https://github.com/RF-Tar-Railt/satori-python
19
+ Requires-Python: <4.0,>=3.10
20
+ Requires-Dist: satori-python-server>=0.17.2
21
+ Description-Content-Type: text/markdown
22
+
23
+ # satori-python
24
+
25
+ ![latest release](https://img.shields.io/github/release/RF-Tar-Railt/satori-python)
26
+ [![Licence](https://img.shields.io/github/license/RF-Tar-Railt/satori-python)](https://github.com/RF-Tar-Railt/satori-python/blob/main/LICENSE)
27
+ [![PyPI](https://img.shields.io/pypi/v/satori-python)](https://pypi.org/project/satori-python)
28
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/satori-python)](https://www.python.org/)
29
+
30
+ 基于 [Satori](https://satori.js.org/zh-CN/) 协议的 Python 开发工具包
31
+
32
+ ## 协议介绍
33
+
34
+ [Satori Protocol](https://satori.js.org/zh-CN/)
35
+
36
+ ### 协议端
37
+
38
+ 目前提供了 `satori` 协议实现的有:
39
+
40
+ - [Chronocat](https://chronocat.vercel.app)
41
+ - [nekobox](https://github.com/wyapx/nekobox)
42
+ - Koishi (搭配 `@koishijs/plugin-server`)
43
+
44
+ ### 使用该 SDK 的框架
45
+
46
+ - [`Entari`](https://github.com/ArcletProject/Entari)
47
+
48
+ ## 安装
49
+
50
+ 安装完整体:
51
+ ```shell
52
+ pip install satori-python
53
+ ```
54
+
55
+ 只安装基础部分:
56
+ ```shell
57
+ pip install satori-python-core
58
+ ```
59
+
60
+ 只安装客户端部分:
61
+ ```shell
62
+ pip install satori-python-client
63
+ ```
64
+
65
+ 只安装服务端部分:
66
+ ```shell
67
+ pip install satori-python-server
68
+ ```
69
+
70
+ ### 官方适配器
71
+
72
+ | 适配器 | 安装 | 路径 |
73
+ |------------|----------------------------------------------|--------------------------------------------------------------------|
74
+ | Satori | `pip install satori-python-adapter-satori` | satori.adapters.satori |
75
+ | OneBot V11 | `pip install satori-python-adapter-onebot11` | satori.adapters.onebot11.forward, satori.adapters.onebot11.reverse |
76
+ | Console | `pip install satori-python-adapter-console` | satori.adapters.console |
77
+ | Milky | `pip install satori-python-adapter-milky` | satori.adapters.milky.main, satori.adapters.milky.webhook |
78
+
79
+ ### 社区适配器
80
+
81
+ | 适配器 | 安装 | 路径 |
82
+ |-------------------|-----------------------|--------------|
83
+ | nekobox(Lagrange) | `pip install nekobox` | nekobox.main |
84
+
85
+ ## 使用
86
+
87
+ 客户端:
88
+
89
+ ```python
90
+ from satori import EventType
91
+ from satori.event import MessageEvent
92
+ from satori.client import Account, App, WebsocketsInfo
93
+
94
+ app = App(WebsocketsInfo(port=5140))
95
+
96
+ @app.register_on(EventType.MESSAGE_CREATED)
97
+ async def on_message(account: Account, event: MessageEvent):
98
+ if event.user.id == "xxxxxxxxxxx":
99
+ await account.send(event, "Hello, World!")
100
+
101
+ app.run()
102
+ ```
103
+
104
+ 服务端:
105
+
106
+ ```python
107
+ from satori import Api
108
+ from satori.server import Server
109
+
110
+ server = Server(port=5140)
111
+
112
+ @server.route(Api.MESSAGE_CREATE)
113
+ async def on_message_create(*args, **kwargs):
114
+ return [{"id": "1234", "content": "example"}]
115
+
116
+ server.run()
117
+ ```
118
+
119
+ ## 文档
120
+
121
+ 请阅读 [仓库文档](./docs.md)
122
+
123
+ ## 示例
124
+
125
+ - 客户端:[client.py](./example/client.py)
126
+ - 服务端:[server.py](./example/server.py)
127
+ - 服务端(使用适配器):[server_with_adapter.py](./example/server_with_adapter.py)
128
+ - 客户端(webhook):[client_webhook](./example/client_webhook.py)
129
+ - 服务端(webhook):[server_webhook](./example/server_webhook.py)
130
+ - 适配器:[adapter.py](./example/adapter.py)
131
+
132
+ ## 架构
133
+
134
+ ```mermaid
135
+ graph LR
136
+ subgraph Server
137
+ server -- run --> asgi
138
+ server -- register --> router -- mount --> asgi
139
+ server -- apply --> provider -- mount --> asgi
140
+ provider -- event,logins --> server
141
+ end
142
+ subgraph Client
143
+ config -- apply --> app -- run --> network
144
+ app -- register --> listener
145
+ network -- account,event --> listener
146
+ listener -- handle --> account -- session --> api
147
+ end
148
+
149
+ api -- request --> asgi -- response --> api
150
+ server -- raw-event --> asgi -- websocket/webhook --> network
151
+ ```
@@ -0,0 +1,129 @@
1
+ # satori-python
2
+
3
+ ![latest release](https://img.shields.io/github/release/RF-Tar-Railt/satori-python)
4
+ [![Licence](https://img.shields.io/github/license/RF-Tar-Railt/satori-python)](https://github.com/RF-Tar-Railt/satori-python/blob/main/LICENSE)
5
+ [![PyPI](https://img.shields.io/pypi/v/satori-python)](https://pypi.org/project/satori-python)
6
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/satori-python)](https://www.python.org/)
7
+
8
+ 基于 [Satori](https://satori.js.org/zh-CN/) 协议的 Python 开发工具包
9
+
10
+ ## 协议介绍
11
+
12
+ [Satori Protocol](https://satori.js.org/zh-CN/)
13
+
14
+ ### 协议端
15
+
16
+ 目前提供了 `satori` 协议实现的有:
17
+
18
+ - [Chronocat](https://chronocat.vercel.app)
19
+ - [nekobox](https://github.com/wyapx/nekobox)
20
+ - Koishi (搭配 `@koishijs/plugin-server`)
21
+
22
+ ### 使用该 SDK 的框架
23
+
24
+ - [`Entari`](https://github.com/ArcletProject/Entari)
25
+
26
+ ## 安装
27
+
28
+ 安装完整体:
29
+ ```shell
30
+ pip install satori-python
31
+ ```
32
+
33
+ 只安装基础部分:
34
+ ```shell
35
+ pip install satori-python-core
36
+ ```
37
+
38
+ 只安装客户端部分:
39
+ ```shell
40
+ pip install satori-python-client
41
+ ```
42
+
43
+ 只安装服务端部分:
44
+ ```shell
45
+ pip install satori-python-server
46
+ ```
47
+
48
+ ### 官方适配器
49
+
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
+ | Milky | `pip install satori-python-adapter-milky` | satori.adapters.milky.main, satori.adapters.milky.webhook |
56
+
57
+ ### 社区适配器
58
+
59
+ | 适配器 | 安装 | 路径 |
60
+ |-------------------|-----------------------|--------------|
61
+ | nekobox(Lagrange) | `pip install nekobox` | nekobox.main |
62
+
63
+ ## 使用
64
+
65
+ 客户端:
66
+
67
+ ```python
68
+ from satori import EventType
69
+ from satori.event import MessageEvent
70
+ from satori.client import Account, App, WebsocketsInfo
71
+
72
+ app = App(WebsocketsInfo(port=5140))
73
+
74
+ @app.register_on(EventType.MESSAGE_CREATED)
75
+ async def on_message(account: Account, event: MessageEvent):
76
+ if event.user.id == "xxxxxxxxxxx":
77
+ await account.send(event, "Hello, World!")
78
+
79
+ app.run()
80
+ ```
81
+
82
+ 服务端:
83
+
84
+ ```python
85
+ from satori import Api
86
+ from satori.server import Server
87
+
88
+ server = Server(port=5140)
89
+
90
+ @server.route(Api.MESSAGE_CREATE)
91
+ async def on_message_create(*args, **kwargs):
92
+ return [{"id": "1234", "content": "example"}]
93
+
94
+ server.run()
95
+ ```
96
+
97
+ ## 文档
98
+
99
+ 请阅读 [仓库文档](./docs.md)
100
+
101
+ ## 示例
102
+
103
+ - 客户端:[client.py](./example/client.py)
104
+ - 服务端:[server.py](./example/server.py)
105
+ - 服务端(使用适配器):[server_with_adapter.py](./example/server_with_adapter.py)
106
+ - 客户端(webhook):[client_webhook](./example/client_webhook.py)
107
+ - 服务端(webhook):[server_webhook](./example/server_webhook.py)
108
+ - 适配器:[adapter.py](./example/adapter.py)
109
+
110
+ ## 架构
111
+
112
+ ```mermaid
113
+ graph LR
114
+ subgraph Server
115
+ server -- run --> asgi
116
+ server -- register --> router -- mount --> asgi
117
+ server -- apply --> provider -- mount --> asgi
118
+ provider -- event,logins --> server
119
+ end
120
+ subgraph Client
121
+ config -- apply --> app -- run --> network
122
+ app -- register --> listener
123
+ network -- account,event --> listener
124
+ listener -- handle --> account -- session --> api
125
+ end
126
+
127
+ api -- request --> asgi -- response --> api
128
+ server -- raw-event --> asgi -- websocket/webhook --> network
129
+ ```
@@ -0,0 +1,117 @@
1
+ [project]
2
+ name = "satori-python-adapter-milky"
3
+ version = "0.1.0"
4
+ authors = [
5
+ { name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com" },
6
+ ]
7
+ dependencies = [
8
+ "satori-python-server >= 0.17.2",
9
+ ]
10
+ description = "Satori Protocol SDK for python, adapter for Milky"
11
+ readme = "README.md"
12
+ requires-python = ">=3.10,<4.0"
13
+ classifiers = [
14
+ "Typing :: Typed",
15
+ "Development Status :: 4 - Beta",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3.8",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Operating System :: OS Independent",
23
+ ]
24
+
25
+ [project.license]
26
+ text = "MIT"
27
+
28
+ [project.urls]
29
+ homepage = "https://github.com/RF-Tar-Railt/satori-python"
30
+ repository = "https://github.com/RF-Tar-Railt/satori-python"
31
+
32
+ [build-system]
33
+ requires = [
34
+ "mina-build<0.6,>=0.5.1",
35
+ "pdm-backend<2.4.0",
36
+ ]
37
+ build-backend = "mina.backend"
38
+
39
+ [dependency-groups]
40
+ dev = [
41
+ "isort>=5.13.2",
42
+ "black>=24.4.0",
43
+ "ruff>=0.4.1",
44
+ "pre-commit>=3.7.0",
45
+ "fix-future-annotations>=0.5.0",
46
+ "mina-build<0.6,>=0.5.1",
47
+ "pdm-mina>=0.3.2",
48
+ "nonechat<0.7.0,>=0.6.0",
49
+ "uvicorn[standard]>=0.35.0",
50
+ ]
51
+
52
+ [tool.pdm.build]
53
+ includes = [
54
+ "src/satori/adapters/milky",
55
+ ".mina/adapter_milky.toml",
56
+ ]
57
+ excludes = [
58
+ "src/satori/adapters/*",
59
+ ]
60
+
61
+ [tool.pdm.scripts.format]
62
+ composite = [
63
+ "isort ./src/ ./example/",
64
+ "black ./src/ ./example/",
65
+ "ruff check",
66
+ ]
67
+
68
+ [tool.pdm.version]
69
+ source = "file"
70
+ path = "src/satori/__init__.py"
71
+
72
+ [tool.black]
73
+ line-length = 120
74
+ include = "\\.pyi?$"
75
+ extend-exclude = ""
76
+
77
+ [tool.isort]
78
+ profile = "black"
79
+ line_length = 120
80
+ skip_gitignore = true
81
+ extra_standard_library = [
82
+ "typing_extensions",
83
+ ]
84
+
85
+ [tool.ruff]
86
+ line-length = 120
87
+ target-version = "py310"
88
+ exclude = [
89
+ "exam_qps.py",
90
+ "exam1.py",
91
+ "exam2.py",
92
+ ]
93
+
94
+ [tool.ruff.lint]
95
+ select = [
96
+ "E",
97
+ "W",
98
+ "F",
99
+ "UP",
100
+ "C",
101
+ "T",
102
+ "Q",
103
+ ]
104
+ ignore = [
105
+ "E402",
106
+ "F403",
107
+ "F405",
108
+ "C901",
109
+ "T201",
110
+ ]
111
+
112
+ [tool.pyright]
113
+ pythonPlatform = "All"
114
+ pythonVersion = "3.10"
115
+ typeCheckingMode = "basic"
116
+ reportShadowedImports = false
117
+ disableBytesTypePromotions = true
@@ -0,0 +1,4 @@
1
+ from .main import MilkyAdapter as MilkyAdapter
2
+ from .webhook import MilkyWebhookAdapter as MilkyWebhookAdapter
3
+
4
+ __all__ = ["MilkyAdapter", "MilkyWebhookAdapter"]