-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
473d33c
commit 5d1011b
Showing
19 changed files
with
3,296 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: Bug 报告 | ||
about: 有关 bug 的报告 | ||
title: "[Bug]" | ||
labels: bug, triage | ||
assignees: "" | ||
--- | ||
|
||
## 请确认: | ||
<!-- 确认后,请将方括号的空格替换为 x --> | ||
* [ ] 问题的标题明确 | ||
* [ ] 我翻阅过其他的 issue 并且找不到类似的问题 | ||
* [ ] 我已经阅读了[相关文档](https://satori.js.org/zh-CN/) 并仍然认为这是一个Bug | ||
|
||
# Bug | ||
|
||
## 问题 | ||
<!-- 你遇到的问题 --> | ||
|
||
## 如何复现 | ||
<!-- 如何复现错误 --> | ||
|
||
## 预期行为 | ||
<!-- 你希望如何更改/原本应该是怎样的 --> | ||
|
||
## 使用环境: | ||
- 操作系统 (Windows/Linux/Mac): | ||
- Python 版本: | ||
- Nonebot2 版本: | ||
- 适配器版本: | ||
- 使用的 Satori 服务端 (例如 Chronocat): | ||
|
||
## 日志/截图 | ||
<!-- 将任何有关的日志/截图放到这里(如:控制台输出) --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
name: Feature 特性请求 | ||
about: 为适配器加份菜 | ||
title: "[Feature] " | ||
labels: enhancement, triage | ||
assignees: "" | ||
--- | ||
|
||
## 请确认: | ||
<!-- 确认后,请将方括号的空格替换为 x --> | ||
* [ ] 新特性的目的明确 | ||
* [ ] 我已经阅读了[相关文档](https://satori.js.org/zh-CN/) 并且找不到类似特性 | ||
|
||
|
||
## Feature | ||
### 概要 | ||
<!-- 这个新特性的功能 --> | ||
|
||
|
||
### 是否已有相关实现 | ||
<!-- 若有, 请在此处贴出 --> | ||
暂无 | ||
|
||
|
||
### 其他内容 | ||
<!-- 你认为有用的其他信息 --> | ||
暂无 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Setup Python | ||
description: Setup Python | ||
|
||
inputs: | ||
python-version: | ||
description: Python version | ||
required: false | ||
default: "3.10" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: pdm-project/setup-pdm@v3 | ||
name: Setup PDM | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
architecture: "x64" | ||
cache: true | ||
|
||
- run: pdm sync -G:all | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python environment | ||
uses: ./.github/actions/setup-python | ||
|
||
- name: Get Version | ||
id: version | ||
run: | | ||
echo "VERSION=$(pdm show --version)" >> $GITHUB_OUTPUT | ||
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | ||
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
- name: Check Version | ||
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION | ||
run: exit 1 | ||
|
||
- name: Publish Package | ||
run: | | ||
pdm publish | ||
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Ruff Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
ruff: | ||
name: Ruff Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Run Ruff Lint | ||
uses: chartboost/ruff-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
default_install_hook_types: [pre-commit, prepare-commit-msg] | ||
ci: | ||
autofix_commit_msg: ":rotating_light: auto fix by pre-commit hooks" | ||
autofix_prs: true | ||
autoupdate_branch: master | ||
autoupdate_schedule: monthly | ||
autoupdate_commit_msg: ":arrow_up: auto update by pre-commit hooks" | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.276 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
stages: [commit] | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
stages: [commit] | ||
|
||
- repo: https://ghproxy.com/github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
stages: [commit] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,71 @@ | ||
# adapter-satori | ||
NoneBot2 Satori 适配器 / Satori Protocol adapter for nonebot2 | ||
<div align="center"> | ||
|
||
# NoneBot-Adapter-Satori | ||
|
||
_✨ NoneBot2 Satori Protocol适配器 / Satori Protocol Adapter for NoneBot2 ✨_ | ||
|
||
</div> | ||
|
||
## 协议介绍 | ||
|
||
[Satori Protocol](https://satori.js.org/zh-CN/) | ||
|
||
## 协议端 | ||
|
||
目前提供了 `satori` 协议实现的有: | ||
- [Chronocat](https://chronocat.vercel.app) | ||
- Satori | ||
- Koishi (搭配 `@koishijs/plugin-server`) | ||
|
||
## 配置 | ||
|
||
修改 NoneBot 配置文件 `.env` 或者 `.env.*`。 | ||
|
||
### Driver | ||
|
||
参考 [driver](https://nonebot.dev/docs/appendices/config#driver) 配置项,添加 `ForwardDriver` 支持。 | ||
|
||
如: | ||
|
||
```dotenv | ||
DRIVER=~httpx+~websockets | ||
DRIVER=~aiohttp | ||
``` | ||
|
||
### SATORI_CLIENTS | ||
|
||
配置连接配置,如: | ||
|
||
```dotenv | ||
SATORI_CLIENTS=' | ||
[ | ||
{ | ||
"port": "localhost", | ||
"host": "5500", | ||
"token": "xxx" | ||
} | ||
] | ||
' | ||
``` | ||
|
||
`host` 与 `port` 为 Satori 服务端的监听地址与端口, | ||
|
||
`token` 由 Satori 服务端决定是否需要。 | ||
|
||
|
||
## 示例 | ||
|
||
```python | ||
from nonebot import on_command | ||
from nonebot.adapters.satori import Bot | ||
from nonebot.adapters.satori.event import MessageEvent | ||
from nonebot.adapters.satori.message import MessageSegment | ||
|
||
|
||
matcher = on_command("test") | ||
|
||
@matcher.handle() | ||
async def handle_receive(bot: Bot, event: MessageEvent): | ||
if event.is_private: | ||
await bot.send(event, MessageSegment.text("Hello, world!")) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from .bot import Bot as Bot | ||
from .adapter import Adapter as Adapter | ||
from .message import Message as Message | ||
from .event import MessageEvent as MessageEvent | ||
from .message import MessageSegment as MessageSegment |
Oops, something went wrong.