Skip to content

Commit

Permalink
exit search mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lgc2333 committed Oct 30, 2023
1 parent e353db1 commit 4272fb5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ Telegram:[@lgc2333](https://t.me/lgc2333)

## 📝 更新日志

### 0.4.3

- 可以退出搜索模式了

### 0.4.2

- resolve [#13](https://github.com/lgc-NB2Dev/nonebot-plugin-multincm/issues/13)
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_multincm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from . import __main__ as __main__ # noqa: E402
from .config import ConfigModel, config # noqa: E402

__version__ = "0.4.2"
__version__ = "0.4.3"
__plugin_meta__ = PluginMetadata(
name="MultiNCM",
description="网易云多选点歌",
Expand Down
4 changes: 3 additions & 1 deletion nonebot_plugin_multincm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ async def search_got_arg(
keyword = arg.strip()
if not keyword:
await matcher.finish("消息无文本,放弃搜索")
if keyword in EXIT_COMMAND:
await matcher.finish("已退出搜索")

searcher = cast(Type[BaseSearcher], state[KEY_SEARCHER_TYPE])(keyword)
state[KEY_SEARCHER] = searcher
Expand Down Expand Up @@ -465,7 +467,7 @@ def register_search_handlers():
c_pri, *c_alias = s.commands
cmd = on_command(c_pri, aliases=set(c_alias), state={KEY_SEARCHER_TYPE: s})
cmd.handle()(search_handle_extract_arg)
cmd.got("arg", "请发送搜索内容")(search_got_arg)
cmd.got("arg", "请发送搜索内容,发送 0 退出搜索")(search_got_arg)
cmd.handle()(search_handle_search)
cmd.receive()(search_receive_select)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nonebot-plugin-multincm"
version = "0.4.2"
version = "0.4.3"
description = "NCM Song Searcher"
authors = [{ name = "student_2333", email = "[email protected]" }]
dependencies = [
Expand Down

0 comments on commit 4272fb5

Please sign in to comment.