Skip to content

Commit 7dd8fb9

Browse files
更新README和workflow
1 parent 1601db3 commit 7dd8fb9

File tree

8 files changed

+266
-4
lines changed

8 files changed

+266
-4
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Bug 反馈
2+
description: 报告可能的异常行为
3+
title: '[BUG] '
4+
labels: [bug]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
欢迎来到 Omikuji 的 Issue Tracker!请填写以下表格来提交 Bug。
10+
- type: input
11+
id: python-version
12+
attributes:
13+
label: Python 版本
14+
description: 可通过 `python --version` 命令查看
15+
placeholder: "3.12"
16+
validations:
17+
required: true
18+
- type: input
19+
id: Omikuji-version
20+
attributes:
21+
label: Omikuji 版本
22+
description: 在插件启动后会输出
23+
placeholder: 0.1.0
24+
validations:
25+
required: true
26+
- type: textarea
27+
id: what-happened
28+
attributes:
29+
label: 发生了什么?
30+
description: 填写你认为的 Omikuji 的不正常行为
31+
validations:
32+
required: true
33+
- type: textarea
34+
id: how-reproduce
35+
attributes:
36+
label: 如何复现
37+
description: 填写应当如何操作才能触发这个不正常行为
38+
placeholder: |
39+
1. xxx
40+
2. xxx
41+
3. xxx
42+
validations:
43+
required: true
44+
- type: textarea
45+
id: what-expected
46+
attributes:
47+
label: 期望的结果?
48+
description: 填写你认为 Omikuji 应当执行的正常行为
49+
validations:
50+
required: true
51+
- type: textarea
52+
id: Omikuji-log
53+
attributes:
54+
label: Bot 运行日志
55+
description: 请粘贴插件运行后报错的控制台内容到此
56+
render: shell
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 新功能
2+
description: 您希望Omikuji添加什么新功能
3+
title: '[New Feature] '
4+
labels: [enhancement]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
欢迎来到 Omikuji 新功能提交处。
10+
- type: textarea
11+
id: feature-new-content
12+
attributes:
13+
label: 什么新功能/改进
14+
description: 您需要的新功能/改进
15+
validations:
16+
required: true
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: 提出问题寻求解答
2+
description: 向开发者/其他用户表达您的疑惑并寻求帮助
3+
title: '[Question] '
4+
labels: [question,help wanted]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
来提问吧~
10+
- type: input
11+
id: python-version
12+
attributes:
13+
label: Python 版本
14+
description: 可通过 `python --version` 命令查看
15+
placeholder: "3.12"
16+
validations:
17+
required: true
18+
- type: input
19+
id: Omikuji-version
20+
attributes:
21+
label: Omikuji 版本
22+
description: 在插件启动后会输出(如果没有成功启动可不填)
23+
placeholder: 0.1.0
24+
validations:
25+
required: false
26+
- type: textarea
27+
id: what-happened
28+
attributes:
29+
label: 您遇到了什么问题?
30+
description: 填写你遇到的问题
31+
validations:
32+
required: true
33+
- type: textarea
34+
id: Omikuji-log
35+
attributes:
36+
label: Omikuji 运行日志
37+
description: 请粘贴插件运行后报错的控制台内容到此,如果您认为这有帮助。
38+
render: shell
39+
validations:
40+
required: false

.github/workflows/CI.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- '**' # 指定触发分支
7+
paths:
8+
- '**' # 监控所有文件变更
9+
10+
jobs:
11+
check:
12+
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') }}
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
22+
- name: Set up Python
23+
run: uv python install
24+
25+
- name: Set up environment
26+
run: |
27+
uv venv
28+
uv sync
29+
30+
- name: Get Python path
31+
run: |
32+
PYTHON_BIN="$(uv run python -c 'import sys; print(sys.executable)')"
33+
echo "PYTHON_BIN=$PYTHON_BIN" >> $GITHUB_ENV
34+
- name: Run Pyright
35+
uses: jakebailey/pyright-action@v2
36+
with:
37+
python-path: ${{ env.PYTHON_BIN }}
38+
pylance-version: latest-release
39+
40+
- name: Check code format
41+
uses: astral-sh/ruff-action@v3
42+
with:
43+
args: check . --exit-non-zero-on-fix
44+
45+
- name: Build package
46+
run: uv build # 生成构建产物到dist目录

.github/workflows/PR.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Pull Requests CI/CD Pipeline
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "**"
7+
paths:
8+
- "**"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v5
20+
21+
- name: Set up Python
22+
run: uv python install
23+
24+
- name: Set up environment
25+
run: |
26+
uv venv
27+
uv sync
28+
29+
- name: Get Python path
30+
run: |
31+
PYTHON_BIN="$(uv run python -c 'import sys; print(sys.executable)')"
32+
echo "PYTHON_BIN=$PYTHON_BIN" >> $GITHUB_ENV
33+
34+
- name: Run Pyright
35+
uses: jakebailey/pyright-action@v2
36+
with:
37+
python-path: ${{ env.PYTHON_BIN }}
38+
pylance-version: latest-release
39+
40+
- name: Check code format
41+
uses: astral-sh/ruff-action@v3
42+
with:
43+
args: check . --exit-non-zero-on-fix
44+
45+
- name: Build package
46+
run: uv build # 生成构建产物到dist目录

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish to PyPI on Release
2+
3+
on:
4+
release:
5+
types: [created] # 当有新Release创建时触发
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v5
17+
18+
- name: Set up Python
19+
run: uv python install
20+
21+
- name: Publish to PyPI
22+
run: |
23+
uv build
24+
uv publish --token ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
1-
# nonebot_plugin_omikuji
2-
LLM-Based omikuji plugin
1+
<div align="center">
2+
<a href="https://github.com/JohnRichard4096/nonebot_plugin_omikuji/">
3+
<img src="https://github.com/user-attachments/assets/b5162036-5b17-4cf4-b0cb-8ec842a71bc6" width="200" alt="omikuji Logo">
4+
</a>
5+
<h1>Omikuji</h1>
6+
<h3>适用于SuggarChat的御神签插件!</h3>
7+
8+
<p>
9+
<a href="https://pypi.org/project/nonebot-plugin-omikuji/">
10+
<img src="https://img.shields.io/pypi/v/nonebot-plugin-omikuji?color=blue&style=flat-square" alt="PyPI Version">
11+
</a>
12+
<a href="https://www.python.org/">
13+
<img src="https://img.shields.io/badge/python-3.10+-blue?logo=python&style=flat-square" alt="Python Version">
14+
</a>
15+
<a href="https://nonebot.dev/">
16+
<img src="https://img.shields.io/badge/nonebot2-2.4.3+-blue?style=flat-square" alt="NoneBot Version">
17+
</a>
18+
<a href="LICENSE">
19+
<img src="https://img.shields.io/github/license/LiteSuggarDEV/nonebot_plugin_omikuji?style=flat-square" alt="License">
20+
</a>
21+
<a href="https://qm.qq.com/q/PFcfb4296m">
22+
<img src="https://img.shields.io/badge/QQ%E7%BE%A4-1002495699-blue?style=flat-square" alt="QQ Group">
23+
</a>
24+
</p>
25+
</div>
26+

nonebot_plugin_omikuji/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
from nonebot import get_driver
1+
import contextlib
2+
3+
from nonebot import get_driver, logger
24
from nonebot.plugin import PluginMetadata, require
35

46
require("nonebot_plugin_suggarchat")
7+
from importlib import metadata
8+
59
from nonebot_plugin_suggarchat.API import ToolsManager
610

711
from . import llm_tool
@@ -10,7 +14,7 @@
1014

1115
__plugin_meta__ = PluginMetadata(
1216
name="御神签",
13-
description="SuggarChat联动的御神签插件",
17+
description="依赖SuggarChat的聊天御神签抽签插件模块",
1418
usage="/omikuji [板块]\n/omikuji 解签\n或者使用聊天直接抽签。",
1519
type="application",
1620
homepage="https://github.com/LiteSuggarDEV/nonebot_plugin_omikuji",
@@ -21,6 +25,12 @@
2125

2226
@get_driver().on_startup
2327
async def init():
28+
version = "Unknown"
29+
with contextlib.suppress(Exception):
30+
version = metadata.version("nonebot_plugin_omikuji")
31+
if "dev" in version:
32+
logger.warning("当前版本为开发版本,可能存在不稳定情况!")
33+
logger.info(f"Loading OMIKUJI V{version}......")
2434
conf = get_config()
2535
if conf.enable_omikuji:
2636
ToolsManager().register_tool(TOOL_DATA)

0 commit comments

Comments
 (0)