| 188 | netease: async (msg: Api.Message) => { |
| 189 | const keyword = getRemarkFromMsg(msg, 0); |
| 190 | |
| 191 | if (!keyword) { |
| 192 | await msg.edit({ text: help_text, parseMode: "html" }); |
| 193 | return; |
| 194 | } |
| 195 | |
| 196 | const client = msg.client; |
| 197 | if (!client) return; |
| 198 | |
| 199 | try { |
| 200 | await msg.edit({ |
| 201 | text: `处理中...`, |
| 202 | parseMode: "html", |
| 203 | }); |
| 204 | } catch {} |
| 205 | |
| 206 | await ensureBotReady(msg); |
| 207 | |
| 208 | // 判定命令:ID -> /music,链接 -> 解析ID -> /music,否则 /search |
| 209 | let commandToBot = `/search ${keyword}`; |
| 210 | if (/^\d+$/.test(keyword.trim())) { |
| 211 | commandToBot = `/music ${keyword.trim()}`; |
| 212 | } else if (keyword.includes("music.163.com")) { |
| 213 | const id = extractSongId(keyword); |
| 214 | if (id) commandToBot = `/music ${id}`; |
| 215 | } |
| 216 | |
| 217 | const caption = `🎵 ${htmlEscape(keyword)}`; |
| 218 | await fetchAndSendAudio(msg, commandToBot, caption); |
| 219 | |
| 220 | try { |
| 221 | await msg.delete(); |
| 222 | } catch {} |
| 223 | }, |
| 224 | }; |
| 225 | } |
| 226 | |
| 227 | export default new NeteasePlugin(); |
nothing calls this directly
no test coverage detected