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

Method handleXmsl

xmsl/xmsl.ts:391–470  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

389
390 // 如果是回复消息且没有参数,则尝试获取被回复消息的内容或媒体
391 if (msg.replyToMsgId && args.length === 0) {
392 try {
393 const replyMsg = await safeGetReplyMessage(msg);
394 if (replyMsg) {
395 // 优先尝试提取媒体
396 const mediaInfo = await this.extractMediaInfo(replyMsg);
397 if (mediaInfo) {
398 const textContent = (replyMsg.text || '').trim();
399 await this.askAI(msg, textContent, mediaInfo);
400 return;
401 }
402
403 // 如果没有媒体,尝试获取文本
404 const question = (replyMsg.text || '').trim();
405 if (question) {
406 await this.askAI(msg, question);
407 return;
408 }
409
410 // 检查是否是转换失败的贴纸格式
411 if (replyMsg.media instanceof Api.MessageMediaDocument) {
412 const doc = (replyMsg.media as Api.MessageMediaDocument).document;
413 if (doc instanceof Api.Document) {
414 if (doc.mimeType === TGS_MIME) {
415 await msg.edit({
416 text: '❌ TGS 贴纸转换失败\n需要安装: <code>pip3 install rlottie-python</code> 和 <code>ffmpeg</code>',
417 parseMode: 'html',
418 });
419 return;
420 }
421 if (doc.mimeType === WEBM_MIME) {
422 await msg.edit({
423 text: '❌ WebM 贴纸转换失败\n需要安装: <code>ffmpeg</code>',
424 parseMode: 'html',
425 });
426 return;
427 }
428 }
429 }
430 }
431 } catch (error) {
432 console.error('[xmsl] 获取回复消息失败:', error);
433 }
434 }
435
436 if (args.length === 0) {
437 // 显示状态
438 await this.showStatus(msg);
439 return;
440 }
441
442 switch (command) {
443 case 'set':
444 await this.handleSet(msg, args.slice(1));
445 break;
446 case 'show':
447 await this.showConfig(msg);
448 break;

Callers

nothing calls this directly

Calls 8

extractMediaInfoMethod · 0.95
askAIMethod · 0.95
showStatusMethod · 0.95
handleSetMethod · 0.95
showConfigMethod · 0.95
htmlEscapeMethod · 0.95
errorMethod · 0.80
editMethod · 0.45

Tested by

no test coverage detected