satori-python-adapter-qq 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,32 @@
1
+ includes = ["src/satori/adapters/qq"]
2
+ raw-dependencies = [
3
+ "satori-python >= 0.18.0",
4
+ "crypography>=46.0.4",
5
+ ]
6
+
7
+ [project]
8
+ name = "satori-python-adapter-qq"
9
+ version = "0.1.0"
10
+ authors = [
11
+ {name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"}
12
+ ]
13
+ dependencies = []
14
+ description = "Satori Protocol SDK for python, adapter for QQ"
15
+ license = {text = "MIT"}
16
+ readme = "README.md"
17
+ requires-python = ">=3.10,<4.0"
18
+ classifiers = [
19
+ "Typing :: Typed",
20
+ "Development Status :: 4 - Beta",
21
+ "License :: OSI Approved :: MIT License",
22
+ "Programming Language :: Python :: 3.8",
23
+ "Programming Language :: Python :: 3.9",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Operating System :: OS Independent",
28
+ ]
29
+
30
+ [project.urls]
31
+ homepage = "https://github.com/RF-Tar-Railt/satori-python"
32
+ 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,154 @@
1
+ Metadata-Version: 2.1
2
+ Name: satori-python-adapter-qq
3
+ Version: 0.1.0
4
+ Summary: Satori Protocol SDK for python, adapter for QQ
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>=0.18.0
21
+ Requires-Dist: crypography>=46.0.4
22
+ Description-Content-Type: text/markdown
23
+
24
+ # satori-python
25
+
26
+ ![latest release](https://img.shields.io/github/release/RF-Tar-Railt/satori-python)
27
+ [![Licence](https://img.shields.io/github/license/RF-Tar-Railt/satori-python)](https://github.com/RF-Tar-Railt/satori-python/blob/main/LICENSE)
28
+ [![PyPI](https://img.shields.io/pypi/v/satori-python)](https://pypi.org/project/satori-python)
29
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/satori-python)](https://www.python.org/)
30
+
31
+ 基于 [Satori](https://satori.chat/zh-CN/) 协议的 Python 开发工具包
32
+
33
+ ## 协议介绍
34
+
35
+ [Satori Protocol](https://satori.chat/zh-CN/)
36
+
37
+ ### 协议端
38
+
39
+ 目前提供了 `satori` 协议实现的有:
40
+
41
+ - [Chronocat](https://chronocat.vercel.app)
42
+ - [LLBot](https://www.llonebot.com/guide/introduction)
43
+ - [nekobox](https://github.com/wyapx/nekobox)
44
+ - Koishi (搭配 `@koishijs/plugin-server`)
45
+
46
+ ### 使用该 SDK 的框架
47
+
48
+ - [`Entari`](https://github.com/ArcletProject/Entari)
49
+
50
+ ## 安装
51
+
52
+ 安装完整体:
53
+ ```shell
54
+ pip install satori-python
55
+ ```
56
+
57
+ 只安装基础部分:
58
+ ```shell
59
+ pip install satori-python-core
60
+ ```
61
+
62
+ 只安装客户端部分:
63
+ ```shell
64
+ pip install satori-python-client
65
+ ```
66
+
67
+ 只安装服务端部分:
68
+ ```shell
69
+ pip install satori-python-server
70
+ ```
71
+
72
+ ### 官方适配器
73
+
74
+ | 适配器 | 安装 | 路径 |
75
+ |------------|----------------------------------------------|--------------------------------------------------------------------|
76
+ | Satori | `pip install satori-python-adapter-satori` | satori.adapters.satori |
77
+ | OneBot V11 | `pip install satori-python-adapter-onebot11` | satori.adapters.onebot11.forward, satori.adapters.onebot11.reverse |
78
+ | Console | `pip install satori-python-adapter-console` | satori.adapters.console |
79
+ | Milky | `pip install satori-python-adapter-milky` | satori.adapters.milky.main, satori.adapters.milky.webhook |
80
+ | QQ | `pip install satori-python-adapter-qq` | satori.adapters.milky.main, satori.adapters.milky.websocket |
81
+
82
+ ### 社区适配器
83
+
84
+ | 适配器 | 安装 | 路径 |
85
+ |-------------------|-----------------------|--------------|
86
+ | nekobox(Lagrange) | `pip install nekobox` | nekobox.main |
87
+
88
+ ## 使用
89
+
90
+ 客户端:
91
+
92
+ ```python
93
+ from satori import EventType
94
+ from satori.event import MessageEvent
95
+ from satori.client import Account, App, WebsocketsInfo
96
+
97
+ app = App(WebsocketsInfo(port=5140))
98
+
99
+ @app.register_on(EventType.MESSAGE_CREATED)
100
+ async def on_message(account: Account, event: MessageEvent):
101
+ if event.user.id == "xxxxxxxxxxx":
102
+ await account.send(event, "Hello, World!")
103
+
104
+ app.run()
105
+ ```
106
+
107
+ 服务端:
108
+
109
+ ```python
110
+ from satori import Api
111
+ from satori.server import Server
112
+
113
+ server = Server(port=5140)
114
+
115
+ @server.route(Api.MESSAGE_CREATE)
116
+ async def on_message_create(*args, **kwargs):
117
+ return [{"id": "1234", "content": "example"}]
118
+
119
+ server.run()
120
+ ```
121
+
122
+ ## 文档
123
+
124
+ 请阅读 [仓库文档](./docs.md)
125
+
126
+ ## 示例
127
+
128
+ - 客户端:[client.py](./example/client.py)
129
+ - 服务端:[server.py](./example/server.py)
130
+ - 服务端(使用适配器):[server_with_adapter.py](./example/server_with_adapter.py)
131
+ - 客户端(webhook):[client_webhook](./example/client_webhook.py)
132
+ - 服务端(webhook):[server_webhook](./example/server_webhook.py)
133
+ - 适配器:[adapter.py](./example/adapter.py)
134
+
135
+ ## 架构
136
+
137
+ ```mermaid
138
+ graph LR
139
+ subgraph Server
140
+ server -- run --> asgi
141
+ server -- register --> router -- mount --> asgi
142
+ server -- apply --> provider -- mount --> asgi
143
+ provider -- event,logins --> server
144
+ end
145
+ subgraph Client
146
+ config -- apply --> app -- run --> network
147
+ app -- register --> listener
148
+ network -- account,event --> listener
149
+ listener -- handle --> account -- session --> api
150
+ end
151
+
152
+ api -- request --> asgi -- response --> api
153
+ server -- raw-event --> asgi -- websocket/webhook --> network
154
+ ```
@@ -0,0 +1,131 @@
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.chat/zh-CN/) 协议的 Python 开发工具包
9
+
10
+ ## 协议介绍
11
+
12
+ [Satori Protocol](https://satori.chat/zh-CN/)
13
+
14
+ ### 协议端
15
+
16
+ 目前提供了 `satori` 协议实现的有:
17
+
18
+ - [Chronocat](https://chronocat.vercel.app)
19
+ - [LLBot](https://www.llonebot.com/guide/introduction)
20
+ - [nekobox](https://github.com/wyapx/nekobox)
21
+ - Koishi (搭配 `@koishijs/plugin-server`)
22
+
23
+ ### 使用该 SDK 的框架
24
+
25
+ - [`Entari`](https://github.com/ArcletProject/Entari)
26
+
27
+ ## 安装
28
+
29
+ 安装完整体:
30
+ ```shell
31
+ pip install satori-python
32
+ ```
33
+
34
+ 只安装基础部分:
35
+ ```shell
36
+ pip install satori-python-core
37
+ ```
38
+
39
+ 只安装客户端部分:
40
+ ```shell
41
+ pip install satori-python-client
42
+ ```
43
+
44
+ 只安装服务端部分:
45
+ ```shell
46
+ pip install satori-python-server
47
+ ```
48
+
49
+ ### 官方适配器
50
+
51
+ | 适配器 | 安装 | 路径 |
52
+ |------------|----------------------------------------------|--------------------------------------------------------------------|
53
+ | Satori | `pip install satori-python-adapter-satori` | satori.adapters.satori |
54
+ | OneBot V11 | `pip install satori-python-adapter-onebot11` | satori.adapters.onebot11.forward, satori.adapters.onebot11.reverse |
55
+ | Console | `pip install satori-python-adapter-console` | satori.adapters.console |
56
+ | Milky | `pip install satori-python-adapter-milky` | satori.adapters.milky.main, satori.adapters.milky.webhook |
57
+ | QQ | `pip install satori-python-adapter-qq` | satori.adapters.milky.main, satori.adapters.milky.websocket |
58
+
59
+ ### 社区适配器
60
+
61
+ | 适配器 | 安装 | 路径 |
62
+ |-------------------|-----------------------|--------------|
63
+ | nekobox(Lagrange) | `pip install nekobox` | nekobox.main |
64
+
65
+ ## 使用
66
+
67
+ 客户端:
68
+
69
+ ```python
70
+ from satori import EventType
71
+ from satori.event import MessageEvent
72
+ from satori.client import Account, App, WebsocketsInfo
73
+
74
+ app = App(WebsocketsInfo(port=5140))
75
+
76
+ @app.register_on(EventType.MESSAGE_CREATED)
77
+ async def on_message(account: Account, event: MessageEvent):
78
+ if event.user.id == "xxxxxxxxxxx":
79
+ await account.send(event, "Hello, World!")
80
+
81
+ app.run()
82
+ ```
83
+
84
+ 服务端:
85
+
86
+ ```python
87
+ from satori import Api
88
+ from satori.server import Server
89
+
90
+ server = Server(port=5140)
91
+
92
+ @server.route(Api.MESSAGE_CREATE)
93
+ async def on_message_create(*args, **kwargs):
94
+ return [{"id": "1234", "content": "example"}]
95
+
96
+ server.run()
97
+ ```
98
+
99
+ ## 文档
100
+
101
+ 请阅读 [仓库文档](./docs.md)
102
+
103
+ ## 示例
104
+
105
+ - 客户端:[client.py](./example/client.py)
106
+ - 服务端:[server.py](./example/server.py)
107
+ - 服务端(使用适配器):[server_with_adapter.py](./example/server_with_adapter.py)
108
+ - 客户端(webhook):[client_webhook](./example/client_webhook.py)
109
+ - 服务端(webhook):[server_webhook](./example/server_webhook.py)
110
+ - 适配器:[adapter.py](./example/adapter.py)
111
+
112
+ ## 架构
113
+
114
+ ```mermaid
115
+ graph LR
116
+ subgraph Server
117
+ server -- run --> asgi
118
+ server -- register --> router -- mount --> asgi
119
+ server -- apply --> provider -- mount --> asgi
120
+ provider -- event,logins --> server
121
+ end
122
+ subgraph Client
123
+ config -- apply --> app -- run --> network
124
+ app -- register --> listener
125
+ network -- account,event --> listener
126
+ listener -- handle --> account -- session --> api
127
+ end
128
+
129
+ api -- request --> asgi -- response --> api
130
+ server -- raw-event --> asgi -- websocket/webhook --> network
131
+ ```
@@ -0,0 +1,119 @@
1
+ [project]
2
+ name = "satori-python-adapter-qq"
3
+ version = "0.1.0"
4
+ authors = [
5
+ { name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com" },
6
+ ]
7
+ dependencies = [
8
+ "satori-python >= 0.18.0",
9
+ "crypography>=46.0.4",
10
+ ]
11
+ description = "Satori Protocol SDK for python, adapter for QQ"
12
+ readme = "README.md"
13
+ requires-python = ">=3.10,<4.0"
14
+ classifiers = [
15
+ "Typing :: Typed",
16
+ "Development Status :: 4 - Beta",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3.8",
19
+ "Programming Language :: Python :: 3.9",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+
26
+ [project.license]
27
+ text = "MIT"
28
+
29
+ [project.urls]
30
+ homepage = "https://github.com/RF-Tar-Railt/satori-python"
31
+ repository = "https://github.com/RF-Tar-Railt/satori-python"
32
+
33
+ [build-system]
34
+ requires = [
35
+ "mina-build<0.6,>=0.5.1",
36
+ "pdm-backend<2.4.0",
37
+ ]
38
+ build-backend = "mina.backend"
39
+
40
+ [dependency-groups]
41
+ dev = [
42
+ "isort>=5.13.2",
43
+ "black>=24.4.0",
44
+ "ruff>=0.4.1",
45
+ "pre-commit>=3.7.0",
46
+ "fix-future-annotations>=0.5.0",
47
+ "mina-build<0.6,>=0.5.1",
48
+ "pdm-mina>=0.3.2",
49
+ "nonechat<0.7.0,>=0.6.0",
50
+ "uvicorn[standard]>=0.37.0",
51
+ ]
52
+
53
+ [tool.pdm.build]
54
+ includes = [
55
+ "src/satori/adapters/qq",
56
+ ".mina/adapter_qq.toml",
57
+ ]
58
+ excludes = [
59
+ "src/satori/adapters/*",
60
+ ]
61
+
62
+ [tool.pdm.scripts.format]
63
+ composite = [
64
+ "isort ./src/ ./example/",
65
+ "black ./src/ ./example/",
66
+ "ruff check",
67
+ ]
68
+
69
+ [tool.pdm.version]
70
+ source = "file"
71
+ path = "src/satori/__init__.py"
72
+
73
+ [tool.black]
74
+ line-length = 120
75
+ include = "\\.pyi?$"
76
+ extend-exclude = ""
77
+
78
+ [tool.isort]
79
+ profile = "black"
80
+ line_length = 120
81
+ skip_gitignore = true
82
+ extra_standard_library = [
83
+ "typing_extensions",
84
+ ]
85
+
86
+ [tool.ruff]
87
+ line-length = 120
88
+ target-version = "py310"
89
+ exclude = [
90
+ "exam_qps.py",
91
+ "exam1.py",
92
+ "exam2.py",
93
+ "src/satori/_vendor/*",
94
+ ]
95
+
96
+ [tool.ruff.lint]
97
+ select = [
98
+ "E",
99
+ "W",
100
+ "F",
101
+ "UP",
102
+ "C",
103
+ "T",
104
+ "Q",
105
+ ]
106
+ ignore = [
107
+ "E402",
108
+ "F403",
109
+ "F405",
110
+ "C901",
111
+ "T201",
112
+ ]
113
+
114
+ [tool.pyright]
115
+ pythonPlatform = "All"
116
+ pythonVersion = "3.10"
117
+ typeCheckingMode = "basic"
118
+ reportShadowedImports = false
119
+ disableBytesTypePromotions = true