Skip to content

Commit 22511f4

Browse files
committed
🐛 fix completion session
1 parent 29b76db commit 22511f4

File tree

5 files changed

+341
-359
lines changed

5 files changed

+341
-359
lines changed

src/nonebot_plugin_alconna/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
from .uniseg import Segment as Segment
7676
from .uniseg import TO_TEXT as TO_TEXT
7777
from .uniseg import get_bot as get_bot
78-
from .matcher import Command as Command
7978
from .typings import Spoiler as Spoiler
79+
from .shortcut import Command as Command
8080
from .uniseg import Keyboard as Keyboard
8181
from .uniseg import ROLLBACK as ROLLBACK
8282
from .matcher import referent as referent
@@ -95,10 +95,10 @@
9595
from .uniseg import UniMessage as UniMessage
9696
from .extension import Extension as Extension
9797
from .extension import Interface as Interface
98-
from .matcher import funcommand as funcommand
9998
from .matcher import on_alconna as on_alconna
10099
from .typings import ImageOrUrl as ImageOrUrl
101100
from .params import match_value as match_value
101+
from .shortcut import funcommand as funcommand
102102
from .uniseg import image_fetch as image_fetch
103103
from .pattern import select_last as select_last
104104
from .params import AlconnaMatch as AlconnaMatch
@@ -125,14 +125,14 @@
125125
from .uniseg import UniversalMessage as UniversalMessage
126126
from .uniseg import UniversalSegment as UniversalSegment
127127
from .params import AlconnaExecResult as AlconnaExecResult
128-
from .matcher import command_from_json as command_from_json
129-
from .matcher import command_from_yaml as command_from_yaml
130128
from .params import AlconnaDuplication as AlconnaDuplication
129+
from .shortcut import command_from_json as command_from_json
130+
from .shortcut import command_from_yaml as command_from_yaml
131131
from .uniseg import apply_media_to_url as apply_media_to_url
132132
from .uniseg import patch_matcher_send as patch_matcher_send
133-
from .matcher import commands_from_json as commands_from_json
134-
from .matcher import commands_from_yaml as commands_from_yaml
135133
from .consts import ALCONNA_EXEC_RESULT as ALCONNA_EXEC_RESULT
134+
from .shortcut import commands_from_json as commands_from_json
135+
from .shortcut import commands_from_yaml as commands_from_yaml
136136
from .uniseg import apply_fetch_targets as apply_fetch_targets
137137
from .uniseg import SupportAdapterModule as SupportAdapterModule
138138
from .extension import add_global_extension as add_global_extension

src/nonebot_plugin_alconna/argv.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ def enter(self, ctx: dict[str, Any] | None = None) -> Self:
3838
return self
3939

4040
def exit(self) -> dict[str, Any]:
41-
argv_ctx.reset(self.context["__token__"])
42-
del self.context["__token__"]
41+
if "__token__" in self.context:
42+
argv_ctx.reset(self.context["__token__"])
43+
del self.context["__token__"]
4344
return super().exit()
4445

4546
def build(self, data: str | list[str] | Message | UniMessage) -> Self:
@@ -138,6 +139,8 @@ def __init__(self):
138139

139140
def spliter(self, x: str):
140141
current_argv = argv_ctx.get()
142+
if "__styles__" not in current_argv.context:
143+
return Text(x)
141144
styles = current_argv.context["__styles__"]
142145
start = styles["msg"].find(x, styles["index"])
143146
if start == -1:

0 commit comments

Comments
 (0)