From 883e391010cebb9c5b5459412f5e1c68ba0861ab Mon Sep 17 00:00:00 2001 From: tt-P607 <68868379+tt-P607@users.noreply.github.com> Date: Fri, 28 Nov 2025 08:24:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(napcat):=20=E5=9C=A8=E8=AF=AD=E9=9F=B3?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=A4=84=E7=90=86=E7=A8=8B=E5=BA=8F=E4=B8=AD?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84=20TTS=20?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `handle_voice_message` 方法中对 `voice.use_tts` 配置的检查已被移除,因为它是多余的。将消息编码为语音的决定在上游处理,因此在此阶段无需此检查。此外,添加了日志警告以处理接收到空语音消息的情况。 --- .../napcat_adapter/src/handlers/to_napcat/send_handler.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/plugins/built_in/napcat_adapter/src/handlers/to_napcat/send_handler.py b/src/plugins/built_in/napcat_adapter/src/handlers/to_napcat/send_handler.py index b832d3ae3..f2a985974 100644 --- a/src/plugins/built_in/napcat_adapter/src/handlers/to_napcat/send_handler.py +++ b/src/plugins/built_in/napcat_adapter/src/handlers/to_napcat/send_handler.py @@ -370,14 +370,8 @@ class SendHandler: def handle_voice_message(self, encoded_voice: str) -> dict: """处理语音消息""" - use_tts = False - if self.plugin_config: - use_tts = config_api.get_plugin_config(self.plugin_config, "voice.use_tts", False) - - if not use_tts: - logger.warning("未启用语音消息处理") - return {} if not encoded_voice: + logger.warning("接收到空的语音消息,跳过处理") return {} return { "type": "record",