|
1 | | -<div align="center"> |
2 | | - |
3 | | -# Edoves |
| 1 | +# arclet-entari |
4 | 2 |
|
5 | | - > _las su dres rin romilu, nann sune ri edar neru._ |
6 | | - |
7 | | -</div> |
| 3 | +一个基于 `Satori` 协议的简易 IM framework |
8 | 4 |
|
9 | | -## 简介 |
10 | | -[](https://github.com/ArcletProject/Edoves/blob/main/LICENSE) |
11 | | -[](https://pypi.org/project/arclet-edoves) |
12 | | -[](https://www.python.org/) |
13 | | - |
| 5 | +## 示例 |
14 | 6 |
|
15 | | -Edoves 是 `Arclet Project` 基于同项目下的 `Cesloi` 的 **第二代** 框架实现, 采取了模块化设计, 最大程度上简化了交互操作 |
16 | | - |
17 | | -**该框架目前处于快速迭代状态, API 可能会发生 _剧烈_ 变化, 建议根据changelog选择合适的版本** |
18 | | - |
19 | | -### [文档 <----](https://arcletproject.github.io/docs/edoves/tutorial) |
20 | | - |
21 | | -## 安装 |
22 | | -``` |
23 | | -pip install --upgrade arclet-edoves |
24 | | -``` |
25 | | - |
26 | | -## 特性 |
27 | | -+ 主要部分 |
28 | | - - [x] `InteractiveObject`: 对`Unity3d`中`GameObject`的简易模仿 |
29 | | - - [x] `Monomer`: 代表逻辑关系的IO |
30 | | - - [ ] `PremissonGroup` 存储权限相关信息 |
31 | | - - [x] `Module`: 负责处理事件的IO |
32 | | - - [x] `ServerDocker`: 负责网络会话交互 |
33 | | - - [x] `Commander`: 基于 `Arclet Alconna` 的指令触发系统 |
34 | | - - [x] `DataParser`: 负责低层级的数据处理 |
35 | | - - [x] `Component`: IO的主要属性, 负责实际的数据管理与事件响应 |
36 | | - - [x] `Medium`: 传输事件信息的载体 |
37 | | - - [x] `Protocol`: 作为数据源与IO的转接层, 负责数据解析与`Medium`的调度 |
38 | | - - [x] `Scene`: 对IO统一的生命周期管理, 是多账号功能的实现 |
39 | | - - [x] `Server`: 对IO的管理, 包括`Scene`的管理 |
40 | | - - [ ] `Permission`: 权限管理 |
41 | | -+ 杂项 |
42 | | - - [x] `NetworkClient`: 对网络端的抽象处理 |
43 | | - - [x] `Filter`: 对事件内容的限制操作 |
44 | | - |
45 | | -+ 实现支持 |
46 | | - - [x] `Edoves for mirai-api-http` : 对 [ `mirai-api-http` ](https://github.com/project-mirai/mirai-api-http) 的支持. |
47 | | - - [ ] `Edoves for OneBot` : 对 [ `OneBot` ](https://github.com/botuniverse/onebot) 的协议实现. |
48 | | - - [ ] `Edoves for go-cqhttp` : 对 [ `go-cqhttp` ](https://github.com/Mrs4s/go-cqhttp) 的扩展 API 支持. |
49 | | - |
50 | | -## 样例 |
51 | | - |
52 | | -main.py: |
53 | 7 | ```python |
54 | | -from arclet.edoves.mah.module import MessageModule |
55 | | -from arclet.edoves.mah import MAHConfig |
56 | | -from arclet.edoves.builtin.medium import Message |
57 | | -from arclet.edoves.builtin.event.message import MessageReceived |
58 | | -from arclet.edoves.builtin.client import AiohttpClient |
59 | | -from arclet.edoves.main import Edoves |
60 | | - |
61 | | - |
62 | | -async def test_message_reaction(message: Message): |
63 | | - if message.content.startswith("Hello World"): |
64 | | - await message.set("I received 'Hello World'!").send() |
| 8 | +from arclet.entari import ContextSession, Entari, EntariCommands, WebsocketsInfo |
65 | 9 |
|
| 10 | +command = EntariCommands() |
66 | 11 |
|
67 | | -app = Edoves( |
68 | | - configs={ |
69 | | - "MAH-default": ( |
70 | | - MAHConfig, |
71 | | - {"verify_token": "INITKEYWylsVdbr", "port": "9080", "client": AiohttpClient, "account": 3542928737} |
72 | | - ) |
73 | | - } |
74 | | -) |
75 | | -with app["MAH-default"].context() as scene: |
76 | | - scene.require_module(MessageModule).add_handler(MessageReceived, test_message_reaction) |
77 | | -app.run() |
78 | | -``` |
79 | | - |
80 | | -## 相关项目 |
81 | 12 |
|
82 | | -> 这些项目都非常优秀, 我相信你听说过他们 |
| 13 | +@command.on("add {a} {b}") |
| 14 | +async def add(a: int, b: int, session: ContextSession): |
| 15 | + await session.send_message(f"{a + b =}") |
83 | 16 |
|
84 | | -+ [`Graia Framework`](https://github.com/GraiaProject) |
85 | | - - [`Avilla`](https://github.com/GraiaProject/Avilla): `Graia Project` 的 "下一代" 框架实现 |
86 | | - - [ `Ariadne` ](https://github.com/GraiaProject/Ariadne): 继承了 `Graia Project` 中 `Application` 并进行了许多改进后产生的作品 |
87 | | -+ [ `Mamoe Technologies` ](https://github.com/mamoe): |
88 | | - - [ `mirai` ](https://github.com/mamoe/mirai) |
89 | | - - [ `mirai-api-http` ](https://github.com/project-mirai/mirai-api-http) |
90 | 17 |
|
91 | | -## 开源协议 |
| 18 | +app = Entari() |
| 19 | +app.apply(WebsocketsInfo(port=5500, token="XXX")) |
92 | 20 |
|
93 | | -Edoves 及其拓展 使用 MIT 作为开源协议. |
| 21 | +app.run() |
94 | 22 |
|
95 | | -但如果你若引用到了使用具有传染性开源协议(如 GPL/AGPL/LGPL 等)的项目, 请遵循相关规则. |
| 23 | +``` |
0 commit comments