Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lgc2333 committed Jan 5, 2024
1 parent d21bf0d commit 864882a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ Telegram:[@lgc2333](https://t.me/lgc2333)

## 📝 更新日志

### 0.1.5

- 修复 `-h` 参数无效的问题

### 0.1.4

- 现在缺少参数会提示了
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_cnrail/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from . import __main__ as __main__ # noqa: E402
from .config import ConfigModel # noqa: E402

__version__ = "0.1.4"
__version__ = "0.1.5"
__plugin_meta__ = PluginMetadata(
name="CNRail",
description="查询 12306 列车时刻表",
Expand Down
12 changes: 8 additions & 4 deletions nonebot_plugin_cnrail/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from typing import Optional

from arclet.alconna import Alconna, Args, Arparma, CommandMeta
from arclet.alconna.exceptions import SpecialOptionTriggered
from httpx import TimeoutException
from nonebot import logger
from nonebot_plugin_alconna import AlconnaMatcher, on_alconna
from nonebot_plugin_alconna import AlconnaMatcher, CommandResult, on_alconna
from nonebot_plugin_alconna.uniseg import UniMessage

from .data_source import MultipleTrainFoundError, query_train_info, render_train_info
Expand Down Expand Up @@ -50,9 +51,12 @@ def parse(df: str) -> Optional[date]:


@search_train_info.handle()
async def _(matcher: AlconnaMatcher, parma: Arparma):
if parma.error_info:
await matcher.finish(f"{parma.error_info}\n使用指令 `train -h` 查看帮助")
async def _(matcher: AlconnaMatcher, res: CommandResult):
if not res.result.error_info:
return
if isinstance(res.result.error_info, SpecialOptionTriggered):
await matcher.finish(res.output)
await matcher.finish(f"{res.result.error_info}\n使用指令 `train -h` 查看帮助")


@search_train_info.handle()
Expand Down

0 comments on commit 864882a

Please sign in to comment.