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

Class IdsPlugin

ids/ids.ts:41–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 description: string = `用户信息查询插件\n\n${help_text}`;
40
41 // 高精度采样点 (ID, Timestamp) - 2026最新校准
42 private readonly ID_DATA_POINTS: [number, number][] = [
43 [0, 1376438400], [50000000, 1400000000], [150000000, 1451606400],
44 [350000000, 1483228800], [500000000, 1514764800], [900000000, 1559347200],
45 [1100000000, 1585699200], [1450000000, 1609459200], [2150000000, 1640995200],
46 [5100000000, 1654041600], [5600000000, 1672531200], [6800000000, 1704067200],
47 [7800000000, 1735689600], [8500000000, 1767225600]
48 ];
49
50 cmdHandlers: Record<string, (msg: Api.Message) => Promise<void>> = {
51 ids: async (msg: Api.Message) => {
52 const client = await getGlobalClient();
53 if (!client) {
54 await msg.edit({ text: "❌ 客户端未初始化", parseMode: "html" });
55 return;
56 }
57
58 const lines = msg.text?.trim()?.split(/\r?\n/g) || [];
59 const parts = lines?.[0]?.split(/\s+/) || [];
60 const [, ...args] = parts;
61 const target = args[0] || "";
62
63 try {
64 if (target === "help" || target === "h") {
65 await msg.edit({ text: help_text, parseMode: "html" });
66 return;
67 }
68
69 await msg.edit({ text: "🔍 <b>正在查询用户信息...</b>", parseMode: "html" });
70
71 let targetUser: any = null;
72 let targetId: number | null = null;
73
74 if (target) {
75 const result = await this.parseTarget(client, target);
76 targetUser = result.user; targetId = result.id;
77 } else {
78 try {
79 const reply = await safeGetReplyMessage(msg);
80 if (reply?.senderId) {
81 targetId = Number(reply.senderId);
82 targetUser = reply.sender;
83 }
84 } catch {}
85 }
86
87 if (!targetUser && !targetId) {
88 const me = await safeGetMe(client);
89 if (!me) return;
90 targetUser = me; targetId = Number(me.id);
91 }
92
93 if (!targetId) {
94 await msg.edit({ text: `❌ 无法获取用户信息`, parseMode: "html" });
95 return;
96 }
97
98 const userInfo = await this.getUserInfo(client, targetUser, targetId, msg);

Callers

nothing calls this directly

Calls 6

parseTargetMethod · 0.95
getUserInfoMethod · 0.95
formatUserInfoMethod · 0.95
sendLongMessageMethod · 0.95
htmlEscapeFunction · 0.70
editMethod · 0.45

Tested by

no test coverage detected