From d56b448f78e5f93df2798c421dc2f5690f17e878 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 26 Jan 2026 08:45:19 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E5=8A=A0=E5=85=A5=E6=96=97=E9=B1=BC?= =?UTF-8?q?=E5=BC=80=E6=92=AD=E4=B8=8B=E6=92=AD=E6=8F=90=E9=86=92"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit f21590e6100a9b4d9e616c078f8f7dcffa5a12be. --- plugins/weather/config.toml | 2 +- plugins/weather/main.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/weather/config.toml b/plugins/weather/config.toml index 7fd914c..dca162f 100644 --- a/plugins/weather/config.toml +++ b/plugins/weather/config.toml @@ -1,6 +1,6 @@ [Weather] enable = true -command = ["天气", "天气订阅", "取消天气订阅"] +command = ["天气", "订阅天气", "取消订阅"] command-format = """ ⚙️获取天气: 天气 城市名 diff --git a/plugins/weather/main.py b/plugins/weather/main.py index e2303a4..cbac1a1 100644 --- a/plugins/weather/main.py +++ b/plugins/weather/main.py @@ -148,7 +148,7 @@ class WeatherPlugin(MessagePluginInterface): def can_process(self, message: Dict[str, Any]) -> bool: if not self.enable: return False content = str(message.get("content", "")).strip() - for cmd in ["天气", "天气订阅", "取消天气订阅"]: + for cmd in ["天气", "订阅天气", "取消订阅"]: if content.startswith(cmd): return True @plugin_stats_decorator(plugin_name="天气查询") @@ -169,10 +169,10 @@ class WeatherPlugin(MessagePluginInterface): # --- 业务分流 --- # 1. 订阅逻辑 (核心修改点) - if content.startswith("天气订阅"): + if content.startswith("订阅天气"): if not self.redis_manager: return False, "数据库未连接" - input_city = content.replace("天气订阅", "").strip() + input_city = content.replace("订阅天气", "").strip() if not input_city: return False, "请指定城市" # Step A: 模糊查询获取 唯一ID 和 标准名 @@ -209,7 +209,7 @@ class WeatherPlugin(MessagePluginInterface): return True, "订阅成功" # 2. 取消订阅 - elif content.startswith("取消天气订阅"): + elif content.startswith("取消订阅"): if not self.redis_manager: return False, "数据库不可用" unique_id = f"{roomid}_{sender}" if roomid else f"private_{sender}" self.redis_manager.remove_subscription(unique_id)