Skip to content

Commit 24c00dd

Browse files
committed
✨ global completion-session config
1 parent a0e5ec0 commit 24c00dd

File tree

14 files changed

+134
-148
lines changed

14 files changed

+134
-148
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async def _():
133133

134134
- ALCONNA_AUTO_SEND_OUTPUT : 是否全局启用输出信息自动发送
135135
- ALCONNA_USE_COMMAND_START : 是否将 COMMAND_START 作为全局命令前缀
136-
- ALCONNA_AUTO_COMPLETION: 是否全局启用补全会话功能
136+
- ALCONNA_GLOBAL_COMPLETION: 全局的补全会话配置 (不代表全局启用补全会话)
137137
- ALCONNA_USE_ORIGIN: 是否全局使用原始消息 (即未经过 to_me 等处理的)
138138
- ALCONNA_USE_PARAM: 是否使用特制的 Param 提供更好的依赖注入
139139
- ALCONNA_USE_CMD_SEP: 是否将 COMMAND_SEP 作为全局命令分隔符

example/.env.prod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ HOST=127.0.0.1
33
PORT=9555
44
ALCONNA_AUTO_SEND_OUTPUT=true
55
ALCONNA_USE_COMMAND_START=true
6+
ALCONNA_GLOBAL_COMPLETION='
7+
{
8+
"tab": "true"
9+
}
10+
'
611
NBP_ALC_PAGE_SIZE=6
712
LOG_LEVEL=DEBUG
813
COMMAND_START=["."]

example/bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
driver.register_adapter(SatoriAdapter)
1111

1212
# nonebot.require("nonebot_plugin_alconna")
13-
nonebot.load_plugin("plugins.demo")
13+
nonebot.load_plugins("plugins")
1414

1515

1616
async def _():

pdm.lock

Lines changed: 78 additions & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = [
55
{name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"},
66
]
77
dependencies = [
8-
"tarina<0.7,>=0.6.3",
8+
"tarina<0.7,>=0.6.8",
99
"nepattern<1.0,>=0.7.7",
1010
"arclet-alconna<2.0,>=1.8.34",
1111
"arclet-alconna-tools>=0.7.10",

src/nonebot_plugin_alconna/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from pydantic import Field, BaseModel
44

5+
from .model import CompConfig
6+
57

68
class Config(BaseModel):
79
"""Plugin Config Here"""
@@ -12,6 +14,9 @@ class Config(BaseModel):
1214
alconna_use_command_start: bool = False
1315
"""是否将 COMMAND_START 作为全局命令前缀"""
1416

17+
alconna_global_completion: Optional[CompConfig] = Field(None, strict=True)
18+
"""全局的补全会话配置 (不代表全局启用补全会话)"""
19+
1520
alconna_use_origin: bool = False
1621
"""是否全局使用原始消息 (即未经过 to_me 等处理的)"""
1722

src/nonebot_plugin_alconna/i18n/.config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"default": "zh-CN",
33
"frozen": [
4-
"completion.nonebot"
4+
"nbp-alc:completion"
55
],
66
"require": [
7-
"completion.nonebot",
87
"nbp-alc"
98
],
109
"name": "nonebot_plugin_alconna"

src/nonebot_plugin_alconna/i18n/.lang.schema.json

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"description": "Schema for lang file",
44
"type": "object",
55
"properties": {
6-
"completion": {
7-
"title": "Completion",
8-
"description": "Scope 'completion' of lang item",
6+
"nbp-alc": {
7+
"title": "Nbp-alc",
8+
"description": "Scope 'nbp-alc' of lang item",
99
"type": "object",
1010
"additionalProperties": false,
1111
"properties": {
12-
"nonebot": {
13-
"title": "Nonebot",
14-
"description": "Scope 'nonebot' of lang item",
12+
"completion": {
13+
"title": "Completion",
14+
"description": "Scope 'completion' of lang item",
1515
"type": "object",
1616
"additionalProperties": false,
1717
"properties": {
@@ -46,15 +46,7 @@
4646
"type": "string"
4747
}
4848
}
49-
}
50-
}
51-
},
52-
"nbp-alc": {
53-
"title": "Nbp-alc",
54-
"description": "Scope 'nbp-alc' of lang item",
55-
"type": "object",
56-
"additionalProperties": false,
57-
"properties": {
49+
},
5850
"log": {
5951
"title": "Log",
6052
"description": "Scope 'log' of lang item",

src/nonebot_plugin_alconna/i18n/.template.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"$schema": "./.template.schema.json",
44
"scopes": [
55
{
6-
"scope": "completion",
6+
"scope": "nbp-alc",
77
"types": [
88
{
9-
"subtype": "nonebot",
9+
"subtype": "completion",
1010
"types": [
1111
"tab",
1212
"enter",
@@ -15,12 +15,7 @@
1515
"timeout",
1616
"exited"
1717
]
18-
}
19-
]
20-
},
21-
{
22-
"scope": "nbp-alc",
23-
"types": [
18+
},
2419
{
2520
"subtype": "log",
2621
"types": [

src/nonebot_plugin_alconna/i18n/en-US.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
{
22
"$schema": ".lang.schema.json",
3-
"completion": {
4-
"nonebot": {
3+
"nbp-alc": {
4+
"completion": {
55
"tab": "Send a {cmd} to toggle prompt",
66
"enter": "Send {cmd} to confirm the prompt as the input",
77
"exit": "Send {cmd} to exit the completion session",
88
"other": "Input which not in above will be confirmed as the input",
99
"timeout": "Completion session timed out. Exited automatically",
1010
"exited": "Completion session exited"
11-
}
12-
},
13-
"nbp-alc": {
11+
},
1412
"log": {
1513
"load_global_extensions": "Loading global extension from {path}",
1614
"got_path": {

0 commit comments

Comments
 (0)