| 1784 | } |
| 1785 | |
| 1786 | const ffmpegInstalled = await DependencyManager.checkFfmpeg(); |
| 1787 | if (!ffmpegInstalled) { |
| 1788 | console.warn("[music] ffmpeg 未安装,音频转换功能受限"); |
| 1789 | } |
| 1790 | |
| 1791 | MusicPlugin.initialized = true; |
| 1792 | } |
| 1793 | |
| 1794 | public name = "music"; |
| 1795 | public description: string; |
| 1796 | public cmdHandlers: Record<string, (msg: Api.Message) => Promise<void>>; |
| 1797 | |
| 1798 | constructor() { |
| 1799 | super(); |
| 1800 | this.description = `🎵 <b>音乐下载助手</b> |
| 1801 | |
| 1802 | <b>使用方法:</b> |
| 1803 | <code>${commandName} 周杰伦 晴天</code> - 搜索下载 |
| 1804 | <code>${commandName} https://...</code> - 链接下载 |
| 1805 | |
| 1806 | <b>配置管理:</b> |
| 1807 | <code>${commandName} config</code> - 查看当前配置 |
| 1808 | <code>${commandName} set cookie [值]</code> - 设置YouTube Cookie |
| 1809 | <code>${commandName} set proxy [地址]</code> - 设置代理服务器 |
| 1810 | <code>${commandName} set api_key [密钥]</code> - 设置Gemini API Key |
| 1811 | <code>${commandName} set base_url [地址]</code> - 设置Gemini Base URL |
| 1812 | <code>${commandName} set model [模型]</code> - 设置Gemini模型 |
| 1813 | <code>${commandName} set quality [音质]</code> - 自定义音频质量 (如: 320k / 192k / 0..10) |
| 1814 | <code>${commandName} clear</code> - 清理临时文件 |
| 1815 | |
| 1816 | <b>配置说明:</b> |
| 1817 | • <code>cookie</code> - 绕过地区限制,提升下载成功率 |
| 1818 | • <code>proxy</code> - 网络代理地址 (如: socks5://127.0.0.1:1080) |
| 1819 | • <code>quality</code> - 音质:支持 <code>320k/256k/192k/128k</code> 等比特率,或 <code>0..10</code> (VBR,数字越小越好) |
| 1820 | |
| 1821 | <b>解决YouTube访问问题:</b> |
| 1822 | |
| 1823 | 🚀 <b>方案1 - WARP+ (推荐):</b> |
| 1824 | <pre>wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh e</pre> |
| 1825 | |
| 1826 | 🔧 <b>方案2 - WireProxy:</b> |
| 1827 | <pre># 安装 WireProxy |
| 1828 | wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh w |
| 1829 | |
| 1830 | # 配置代理(WireProxy 默认端口 40000) |
| 1831 | ${commandName} set proxy socks5://127.0.0.1:40000</pre> |
| 1832 | |
| 1833 | 💡 <i>直接输入歌名即可快速搜索下载</i>`; |
| 1834 | |
| 1835 | this.downloader = new Downloader(); |
| 1836 | this.downloader.cleanCache().catch(() => {}); |
| 1837 | |
| 1838 | // 注册命令处理器 |
| 1839 | this.cmdHandlers = { |
| 1840 | music: this.execute.bind(this), |
| 1841 | }; |
| 1842 | } |
| 1843 |
nothing calls this directly
no outgoing calls
no test coverage detected