MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / NeteasePlugin

Class NeteasePlugin

netease/netease.ts:190–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
227export default new NeteasePlugin();

Callers

nothing calls this directly

Calls 7

extractSongIdFunction · 0.85
fetchAndSendAudioFunction · 0.85
getRemarkFromMsgFunction · 0.70
ensureBotReadyFunction · 0.70
htmlEscapeFunction · 0.70
editMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected