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

Method formatEntity

trace/trace.ts:496–522  ·  view source on GitHub ↗
(target: string | Api.TypePeer, mention?: boolean, throwErrorIfFailed?: boolean)

Source from the content-addressed store, hash-verified

494 await this.editAndDelete(msg, cleanMsg, 10);
495 }
496
497 private async resetDatabase(msg: Api.Message) {
498 const prevUserCount = Object.keys(this.db.data.users || {}).length;
499 const prevKeywordCount = Object.keys(this.db.data.keywords || {}).length;
500 this.db.data = { ...defaultState };
501 await this.db.write();
502 const resetMsg = `⚠️ <b>数据库重置</b>\n` +
503 `├ 📊 已清除数据\n` +
504 `│ ├ 用户: ${prevUserCount} 个\n` +
505 `│ └ 关键字: ${prevKeywordCount} 个\n` +
506 `└ ✅ 恢复默认设置`;
507 await this.editAndDelete(msg, resetMsg, 10);
508 }
509
510 private async setConfig(msg: Api.Message, key: "keepLog" | "big", value: string) {
511 const boolValue = value?.toLowerCase() === "true";
512 if (value === undefined || (value.toLowerCase() !== "true" && value.toLowerCase() !== "false")) {
513 await this.editAndDelete(msg, `❌ <b>参数错误</b>\n└ 请使用 <code>true</code> 或 <code>false</code>`);
514 return;
515 }
516 const previousValue = this.db.data.config[key];
517 this.db.data.config[key] = boolValue;
518 await this.db.write();
519 const configName = key === 'keepLog' ? '保留日志' : '大号动画';
520 const icon = key === 'keepLog' ? '📝' : '🎭';
521 const configMsg = `⚙️ <b>配置更新</b>\n` +
522 `├ ${icon} 项目: ${configName}\n` +
523 `├ 🔄 旧值: ${previousValue ? '✅ 启用' : '❌ 禁用'}\n` +
524 `├ ✨ 新值: ${boolValue ? '✅ 启用' : '❌ 禁用'}\n` +
525 `└ 💾 配置已保存`;

Callers 3

traceUserMethod · 0.95
untraceUserMethod · 0.95
showStatusMethod · 0.95

Calls 1

htmlEscapeFunction · 0.70

Tested by

no test coverage detected