From 402214aec857ecde6f2fc0e81bdcccbc7d677bbf Mon Sep 17 00:00:00 2001 From: RF-Tar-Railt <3165388245@qq.com> Date: Thu, 26 Oct 2023 17:35:20 +0800 Subject: [PATCH] :bug: version 0.30.6 fix followed blank --- example/bot.py | 3 +++ example/plugins/demo.py | 6 +++--- src/nonebot_plugin_alconna/__init__.py | 2 +- src/nonebot_plugin_alconna/argv.py | 2 ++ src/nonebot_plugin_alconna/uniseg/__init__.py | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/example/bot.py b/example/bot.py index a55d8e8..8706ea0 100644 --- a/example/bot.py +++ b/example/bot.py @@ -1,10 +1,13 @@ import nonebot + +# from nonebot.adapters.qq import Adapter as QQAdapter from nonebot.adapters.onebot.v12 import Adapter as ONEBOT_V12Adapter nonebot.init() driver = nonebot.get_driver() driver.register_adapter(ONEBOT_V12Adapter) +# driver.register_adapter(QQAdapter) # nonebot.require("nonebot_plugin_alconna") nonebot.load_plugin("plugins.demo") diff --git a/example/plugins/demo.py b/example/plugins/demo.py index f98f6a1..d7f82a0 100644 --- a/example/plugins/demo.py +++ b/example/plugins/demo.py @@ -7,7 +7,6 @@ from importlib_metadata import distributions from nonebot.adapters.onebot.v12.event import GroupMessageDeleteEvent from arclet.alconna import ( - Arg, Args, Field, Option, @@ -392,8 +391,9 @@ async def statis_h(): alc = Alconna( "添加教师", - Arg("name", str, Field(completion=lambda: "请输入姓名")), - Arg("phone", int, Field(completion=lambda: "请输入手机号")), + Args["name", str, Field(completion=lambda: "请输入姓名")], + Args["phone", int, Field(completion=lambda: "请输入手机号")], + Args["at", [str, At], Field(completion=lambda: "请输入教师号")], ) cmd = on_alconna(alc, comp_config={"disables": {"tab"}}) diff --git a/src/nonebot_plugin_alconna/__init__.py b/src/nonebot_plugin_alconna/__init__.py index c31b8ce..710bdc3 100644 --- a/src/nonebot_plugin_alconna/__init__.py +++ b/src/nonebot_plugin_alconna/__init__.py @@ -89,7 +89,7 @@ from .consts import ALCONNA_EXEC_RESULT as ALCONNA_EXEC_RESULT from .extension import add_global_extension as add_global_extension -__version__ = "0.30.5" +__version__ = "0.30.6" __plugin_meta__ = PluginMetadata( name="Alconna 插件", diff --git a/src/nonebot_plugin_alconna/argv.py b/src/nonebot_plugin_alconna/argv.py index 43d2cc8..df90672 100644 --- a/src/nonebot_plugin_alconna/argv.py +++ b/src/nonebot_plugin_alconna/argv.py @@ -96,6 +96,8 @@ def addon(self, data: Iterable[str | MessageSegment]) -> Self: self.raw_data.append(d) self.ndata += 1 continue + if not text.strip("\xa0").strip(): + continue if i > 0 and isinstance(self.raw_data[-1], str): self.raw_data[-1] += f"{self.separators[0]}{text}" else: diff --git a/src/nonebot_plugin_alconna/uniseg/__init__.py b/src/nonebot_plugin_alconna/uniseg/__init__.py index 58fd410..0ecbb39 100644 --- a/src/nonebot_plugin_alconna/uniseg/__init__.py +++ b/src/nonebot_plugin_alconna/uniseg/__init__.py @@ -24,7 +24,7 @@ from .params import UniversalMessage as UniversalMessage from .params import UniversalSegment as UniversalSegment -__version__ = "0.30.5" +__version__ = "0.30.6" __plugin_meta__ = PluginMetadata( name="Universal Segment 插件",