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)