(msg: Api.Message, args: string[])
| 1215 | } |
| 1216 | |
| 1217 | async function handleTTS(msg: Api.Message, args: string[]): Promise<void> { |
| 1218 | const replyMsg = await msg.getReplyMessage(); |
| 1219 | const { userQuestion, displayQuestion, apiQuestion } = extractQuestionFromArgs(args, replyMsg); |
| 1220 | |
| 1221 | if (!apiQuestion) { |
| 1222 | await msg.edit({ text: "❌ 请提供要转换为语音的文本或回复一条有文字内容的消息" }); |
| 1223 | return; |
| 1224 | } |
| 1225 | |
| 1226 | await msg.edit({ text: "🗣️ 生成语音中..." }); |
| 1227 | |
| 1228 | try { |
| 1229 | await processAudioGeneration(msg, apiQuestion, 'TTS Handler', replyMsg); |
| 1230 | } catch (error: any) { |
| 1231 | await msg.edit({ text: `❌ 语音生成失败: ${error.message || '未知错误'}` }); |
| 1232 | } |
| 1233 | } |
| 1234 | |
| 1235 | async function handleQuestionWithAudio( |
| 1236 | msg: Api.Message, |
no test coverage detected