Skip to content

Commit e33ddd4

Browse files
authored
💥 version 0.1.0
Refactor Edoves to Entari
1 parent 765e38f commit e33ddd4

84 files changed

Lines changed: 2578 additions & 94 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Bug 报告
3+
about: 有关 bug 的报告
4+
title: "[Bug]"
5+
labels: bug, triage
6+
assignees: ""
7+
---
8+
9+
## 请确认:
10+
<!-- 确认后,请将方括号的空格替换为 x -->
11+
* [ ] 问题的标题明确
12+
* [ ] 我翻阅过其他的issue并且找不到类似的问题
13+
* [ ] 我已经阅读了[相关文档](https://satori.chat/zh-CN/) 并仍然认为这是一个Bug
14+
15+
# Bug
16+
17+
## 问题
18+
<!-- 你遇到的问题 -->
19+
20+
## 如何复现
21+
<!-- 如何复现错误 -->
22+
23+
## 预期行为
24+
<!-- 你希望如何更改/原本应该是怎样的 -->
25+
26+
## 使用环境:
27+
- Python 版本:
28+
- Entari 版本:
29+
30+
## 日志/截图
31+
<!-- 将任何有关的日志/截图放到这里(如:控制台输出) -->

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Feature 特性请求
3+
about: 为 Entari 加份菜
4+
title: "[Feature] "
5+
labels: enhancement, triage
6+
assignees: ""
7+
---
8+
9+
## 请确认:
10+
<!-- 确认后,请将方括号的空格替换为 x -->
11+
* [ ] 新特性的目的明确
12+
* [ ] 我已经阅读了[相关文档](https://satori.chat/zh-CN) 并且找不到类似特性
13+
14+
15+
## Feature
16+
### 概要
17+
<!-- 这个新特性的功能 -->
18+
19+
20+
### 是否已有相关实现
21+
<!-- 若有, 请在此处贴出 -->
22+
暂无
23+
24+
25+
### 其他内容
26+
<!-- 你认为有用的其他信息 -->
27+
暂无
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Setup Python
2+
description: Setup Python
3+
4+
inputs:
5+
python-version:
6+
description: Python version
7+
required: false
8+
default: "3.10"
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- uses: pdm-project/setup-pdm@v3
14+
name: Setup PDM
15+
with:
16+
python-version: ${{ inputs.python-version }}
17+
architecture: "x64"
18+
cache: true
19+
20+
- run: pdm sync -G:all
21+
shell: bash

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "github-actions" # See documentation for possible values
14+
directory: "/" # Location of package manifests
15+
schedule:
16+
interval: "weekly"

.github/workflows/auto-merge.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Dependabot auto-merge
2+
on: pull_request_target
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v1.6.0
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
- name: Enable auto-merge for Dependabot PRs
19+
run: gh pr merge --auto --squash "$PR_URL"
20+
env:
21+
PR_URL: ${{github.event.pull_request.html_url}}
22+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup Python environment
18+
uses: ./.github/actions/setup-python
19+
20+
- name: Get Version
21+
id: version
22+
run: |
23+
echo "VERSION=$(pdm show --version)" >> $GITHUB_OUTPUT
24+
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
25+
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
26+
27+
- name: Check Version
28+
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
29+
run: exit 1
30+
31+
- name: Publish Package
32+
run: |
33+
pdm publish
34+
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ruff.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Ruff Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
ruff:
11+
name: Ruff Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Run Ruff Lint
17+
uses: chartboost/ruff-action@v1

.gitignore

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ parts/
2020
sdist/
2121
var/
2222
wheels/
23-
pip-wheel-metadata/
2423
share/python-wheels/
2524
*.egg-info/
2625
.installed.cfg
@@ -50,6 +49,7 @@ coverage.xml
5049
*.py,cover
5150
.hypothesis/
5251
.pytest_cache/
52+
cover/
5353

5454
# Translations
5555
*.mo
@@ -72,6 +72,7 @@ instance/
7272
docs/_build/
7373

7474
# PyBuilder
75+
.pybuilder/
7576
target/
7677

7778
# Jupyter Notebook
@@ -82,7 +83,9 @@ profile_default/
8283
ipython_config.py
8384

8485
# pyenv
85-
.python-version
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
8689

8790
# pipenv
8891
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
@@ -91,7 +94,24 @@ ipython_config.py
9194
# install all needed dependencies.
9295
#Pipfile.lock
9396

94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
.pdm-python
112+
.pdm-build/
113+
114+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
95115
__pypackages__/
96116

97117
# Celery stuff
@@ -127,3 +147,16 @@ dmypy.json
127147

128148
# Pyre type checker
129149
.pyre/
150+
151+
# pytype static type analyzer
152+
.pytype/
153+
154+
# Cython debug symbols
155+
cython_debug/
156+
157+
# PyCharm
158+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160+
# and can be added to the global gitignore or merged into this file. For a more nuclear
161+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162+
.idea/

README.md

Lines changed: 12 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,23 @@
1-
<div align="center">
2-
3-
# Edoves
1+
# arclet-entari
42

5-
> _las su dres rin romilu, nann sune ri edar neru._
6-
7-
</div>
3+
一个基于 `Satori` 协议的简易 IM framework
84

9-
## 简介
10-
[![Licence](https://img.shields.io/github/license/ArcletProject/Edoves)](https://github.com/ArcletProject/Edoves/blob/main/LICENSE)
11-
[![PyPI](https://img.shields.io/pypi/v/arclet-edoves)](https://pypi.org/project/arclet-edoves)
12-
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/arclet-edoves)](https://www.python.org/)
13-
![Edoves](https://img.shields.io/badge/Arclet-Edoves-2564c2.svg)
5+
## 示例
146

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:
537
```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
659

10+
command = EntariCommands()
6611

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-
## 相关项目
8112

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 =}")
8316

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)
9017

91-
## 开源协议
18+
app = Entari()
19+
app.apply(WebsocketsInfo(port=5500, token="XXX"))
9220

93-
Edoves 及其拓展 使用 MIT 作为开源协议.
21+
app.run()
9422

95-
但如果你若引用到了使用具有传染性开源协议(如 GPL/AGPL/LGPL 等)的项目, 请遵循相关规则.
23+
```

0 commit comments

Comments
 (0)