(msg: Api.Message, args: string[])
| 1612 | } |
| 1613 | |
| 1614 | async function handleTTSVoice(msg: Api.Message, args: string[]): Promise<void> { |
| 1615 | if (args.length === 0) { |
| 1616 | await msg.edit({ text: "❌ 用法: gemini ttsvoice <语音名称> 或 gemini ttsvoice list" }); |
| 1617 | return; |
| 1618 | } |
| 1619 | |
| 1620 | if (args[0].toLowerCase() === 'list') { |
| 1621 | const availableVoices = [ |
| 1622 | "Achernar", "Achird", "Algenib", "Algieba", "Alnilam", "Aoede", "Autonoe", "Callirrhoe", |
| 1623 | "Charon", "Despina", "Enceladus", "Erinome", "Fenrir", "Gacrux", "Iapetus", "Kore", |
| 1624 | "Laomedeia", "Leda", "Orus", "Puck", "Pulcherrima", "Rasalgethi", "Sadachbia", |
| 1625 | "Sadaltager", "Schedar", "Sulafat", "Umbriel", "Vindemiatrix", "Zephyr", "Zubenelgenubi" |
| 1626 | ]; |
| 1627 | |
| 1628 | const currentVoice = getConfig(CONFIG_KEYS.GEMINI_TTS_VOICE); |
| 1629 | let voiceList = "🎵 <b>可用的 TTS 音色列表:</b>\n\n"; |
| 1630 | |
| 1631 | availableVoices.forEach(voice => { |
| 1632 | if (voice === currentVoice) { |
| 1633 | voiceList += `• <b>${voice}</b> ✅ (当前使用)\n`; |
| 1634 | } else { |
| 1635 | voiceList += `• ${voice}\n`; |
| 1636 | } |
| 1637 | }); |
| 1638 | |
| 1639 | voiceList += "\n💡 使用 <code>gemini ttsvoice <音色名称></code> 来设置音色"; |
| 1640 | |
| 1641 | await msg.edit({ text: voiceList, parseMode: "html" }); |
| 1642 | return; |
| 1643 | } |
| 1644 | |
| 1645 | const voiceName = args.join(" "); |
| 1646 | |
| 1647 | const availableVoices = [ |
| 1648 | "Achernar", "Achird", "Algenib", "Algieba", "Alnilam", "Aoede", "Autonoe", "Callirrhoe", |
| 1649 | "Charon", "Despina", "Enceladus", "Erinome", "Fenrir", "Gacrux", "Iapetus", "Kore", |
| 1650 | "Laomedeia", "Leda", "Orus", "Puck", "Pulcherrima", "Rasalgethi", "Sadachbia", |
| 1651 | "Sadaltager", "Schedar", "Sulafat", "Umbriel", "Vindemiatrix", "Zephyr", "Zubenelgenubi" |
| 1652 | ]; |
| 1653 | |
| 1654 | if (!availableVoices.includes(voiceName)) { |
| 1655 | await msg.edit({ |
| 1656 | text: `❌ 无效的音色名称: <code>${voiceName}</code>\n\n💡 使用 <code>gemini ttsvoice list</code> 查看所有可用音色`, |
| 1657 | parseMode: "html" |
| 1658 | }); |
| 1659 | return; |
| 1660 | } |
| 1661 | |
| 1662 | ConfigManager.set(CONFIG_KEYS.GEMINI_TTS_VOICE, voiceName); |
| 1663 | await msg.edit({ text: `✅ Gemini TTS 语音已设置为: <code>${voiceName}</code>`, parseMode: "html" }); |
| 1664 | } |
| 1665 | |
| 1666 | async function handleGeminiRequest(msg: Api.Message): Promise<void> { |
| 1667 | const [, ...args] = msg.message.slice(1).split(" "); |
no test coverage detected