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

Method showStatus

trace/trace.ts:382–449  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

380 await this.editAndDelete(msg, "❌ <b>操作失败</b>\n├ 未找到有效的表情符号\n└ 请检查帮助中的可用列表");
381 return;
382 }
383 const isUpdate = keyword in this.db.data.keywords;
384 this.db.data.keywords[keyword] = reactions;
385 await this.db.write();
386 // Extract actual emojis from the original message for display
387 const reactionDisplay = await this.getReactionDisplay(msg, emojiText, reactions);
388 const reactionCount = reactions.length;
389 const customCount = reactions.filter(r => typeof r !== 'string').length;
390 const successMsg = `✅ <b>${isUpdate ? '更新' : '添加'}关键字追踪</b>\n` +
391 `├ 🔑 关键字: <code>${htmlEscape(keyword)}</code>\n` +
392 `├ 🎯 表情: ${reactionDisplay}\n` +
393 `├ 📊 表情数: ${reactionCount} 个${customCount > 0 ? ` (${customCount} 个会员表情)` : ''}\n` +
394 `└ 📊 当前追踪: ${Object.keys(this.db.data.keywords).length} 个关键字`;
395 await this.editAndDelete(msg, successMsg, 10);
396 }
397
398 private async untraceKeyword(msg: Api.Message, keyword: string) {
399 if (this.db.data.keywords[keyword]) {
400 const standardCount = this.db.data.keywords[keyword].filter((r: string | BigInteger) => typeof r === 'string').length;
401 const customCount = this.db.data.keywords[keyword].filter((r: string | BigInteger) => typeof r !== 'string').length;
402 const previousReactions = `${standardCount}个标准 + ${customCount}个会员表情`;
403 delete this.db.data.keywords[keyword];
404 await this.db.write();
405 const untrackMsg = `🗑️ <b>删除关键字追踪</b>\n` +
406 `├ 🔑 关键字: <code>${htmlEscape(keyword)}</code>\n` +
407 `├ 🎯 原表情: ${previousReactions}\n` +
408 `└ 📊 剩余追踪: ${Object.keys(this.db.data.keywords).length} 个关键字`;
409 await this.editAndDelete(msg, untrackMsg, 10);
410 } else {
411 await this.editAndDelete(msg, `ℹ️ <b>提示</b>\n└ 关键字 "<code>${htmlEscape(keyword)}</code>" 未被追踪`);
412 }
413 }
414
415 private async showStatus(msg: Api.Message) {
416 const users = this.db.data.users || {};
417 const keywords = this.db.data.keywords || {};
418 const userCount = Object.keys(users).length;
419 const keywordCount = Object.keys(keywords).length;
420 const currentTime = new Date().toLocaleString('zh-CN', {
421 timeZone: 'Asia/Shanghai',
422 hour12: false
423 });
424
425 let response = `📊 <b>Trace 追踪状态面板</b>\n`;
426 response += `━━━━━━━━━━━━━━━━\n`;
427 response += `🕐 <i>${currentTime}</i>\n\n`;
428
429 // Statistics section
430 response += `📈 <b>统计信息</b>\n`;
431 response += `├ 👥 追踪用户: <b>${userCount}</b> 个\n`;
432 response += `├ 🔑 追踪关键字: <b>${keywordCount}</b> 个\n`;
433 response += `└ 📊 总计: <b>${userCount + keywordCount}</b> 项\n\n`;
434
435 // Users section
436 response += `👤 <b>追踪的用户</b> (${userCount})\n`;
437 if (userCount > 0) {
438 response += `┌──────────\n`;
439 let index = 0;

Callers 1

handleTraceMethod · 0.95

Calls 3

formatEntityMethod · 0.95
htmlEscapeFunction · 0.70
editMethod · 0.45

Tested by

no test coverage detected