Skip to content

Commit e98b6dd

Browse files
committed
🐛 fix missing ValidationError
1 parent c068aaa commit e98b6dd

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

example/.env.prod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ALCONNA_AUTO_SEND_OUTPUT=true
55
ALCONNA_USE_COMMAND_START=true
66
ALCONNA_GLOBAL_COMPLETION='
77
{
8-
"tab": "true"
8+
"tab": "True"
99
}
1010
'
1111
NBP_ALC_PAGE_SIZE=6

src/nonebot_plugin_alconna/rule.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
_modules = set()
2727

2828

29+
def _get_driver():
30+
try:
31+
return get_driver()
32+
except ValueError as e:
33+
raise RuntimeError(*e.args) from e
34+
35+
2936
def check_self_send(bot: Bot, event: Event) -> bool:
3037
try:
3138
user_id = event.get_user_id()
@@ -87,7 +94,7 @@ def __init__(
8794
self.comp_config = comp_config
8895
self.use_origin = use_origin or False
8996
try:
90-
global_config = get_driver().config
97+
global_config = _get_driver().config
9198
config = get_plugin_config(Config)
9299
if config.alconna_global_completion is not None and self.comp_config == {}:
93100
self.comp_config = config.alconna_global_completion
@@ -123,8 +130,10 @@ def __init__(
123130
with command_manager.update(command):
124131
command.meta.context_style = config.alconna_context_style
125132
self.use_origin = config.alconna_use_origin if use_origin is None else use_origin
126-
except ValueError:
133+
except RuntimeError:
127134
self.auto_send = True if auto_send_output is None else auto_send_output
135+
self.response_self = False if response_self is None else response_self
136+
self.use_origin = False if use_origin is None else use_origin
128137

129138
def _update(cmd_id: int):
130139
try:

0 commit comments

Comments
 (0)