From 6c8553e9b6326c9f948acf6a7418f45331d008dd Mon Sep 17 00:00:00 2001 From: liuwei Date: Tue, 20 May 2025 15:41:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=A4=A9=E6=B0=94=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/weather/config.toml | 3 --- plugins/weather/main.py | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/weather/config.toml b/plugins/weather/config.toml index 4e13274..38b0b80 100644 --- a/plugins/weather/config.toml +++ b/plugins/weather/config.toml @@ -4,9 +4,6 @@ command = ["天气"] command-format = """ ⚙️获取天气: 天气 城市名 -天气城市名 -城市名天气 -城市名 天气 """ # 和风天气API配置 API_KEY= "32e692f94e364105808ea2c0302ef162" # 请填写您的和风天气API密钥 diff --git a/plugins/weather/main.py b/plugins/weather/main.py index 6fcbd2d..5ea78f3 100644 --- a/plugins/weather/main.py +++ b/plugins/weather/main.py @@ -84,10 +84,11 @@ class WeatherPlugin(MessagePluginInterface): roomid = message.get("roomid", "") # 只处理群消息且包含"天气"的消息 - if not roomid and not (content.startswith("天气") or content.endswith("天气")): + if not roomid: return False - return True + command = content.split(" ")[0] + return command in self._commands @plugin_stats_decorator(plugin_name="天气查询") @plugin_points_cost(2, "天气查询消耗积分", Feature.WEATHER)