Skip to content

Commit

Permalink
🐛 fix missing ValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Dec 8, 2024
1 parent c068aaa commit e98b6dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/.env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ALCONNA_AUTO_SEND_OUTPUT=true
ALCONNA_USE_COMMAND_START=true
ALCONNA_GLOBAL_COMPLETION='
{
"tab": "true"
"tab": "True"
}
'
NBP_ALC_PAGE_SIZE=6
Expand Down
13 changes: 11 additions & 2 deletions src/nonebot_plugin_alconna/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
_modules = set()


def _get_driver():
try:
return get_driver()
except ValueError as e:
raise RuntimeError(*e.args) from e


def check_self_send(bot: Bot, event: Event) -> bool:
try:
user_id = event.get_user_id()
Expand Down Expand Up @@ -87,7 +94,7 @@ def __init__(
self.comp_config = comp_config
self.use_origin = use_origin or False
try:
global_config = get_driver().config
global_config = _get_driver().config
config = get_plugin_config(Config)
if config.alconna_global_completion is not None and self.comp_config == {}:
self.comp_config = config.alconna_global_completion
Expand Down Expand Up @@ -123,8 +130,10 @@ def __init__(
with command_manager.update(command):
command.meta.context_style = config.alconna_context_style
self.use_origin = config.alconna_use_origin if use_origin is None else use_origin
except ValueError:
except RuntimeError:
self.auto_send = True if auto_send_output is None else auto_send_output
self.response_self = False if response_self is None else response_self
self.use_origin = False if use_origin is None else use_origin

def _update(cmd_id: int):
try:
Expand Down

0 comments on commit e98b6dd

Please sign in to comment.