diff --git a/plugins/weather/config.toml b/plugins/weather/config.toml index dca162f..7fd914c 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 cbac1a1..e2303a4 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)